Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install controller-gen failed: sf.IsExported undefined #643

Closed
ycyxuehan opened this issue Dec 1, 2021 · 22 comments
Closed

install controller-gen failed: sf.IsExported undefined #643

ycyxuehan opened this issue Dec 1, 2021 · 22 comments

Comments

@ycyxuehan
Copy link

go build -o ${HOME}/go/bin/controller-gen main.go
# sigs.k8s.io/json/internal/golang/encoding/json
/root/go/pkg/mod/sigs.k8s.io/json@v0.0.0-20211020170558-c049b76a60c6/internal/golang/encoding/json/encode.go:1249:12: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
/root/go/pkg/mod/sigs.k8s.io/json@v0.0.0-20211020170558-c049b76a60c6/internal/golang/encoding/json/encode.go:1255:18: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
go version
go version go1.16.10 linux/amd64
@Thor-wl
Copy link

Thor-wl commented Dec 17, 2021

+1

2 similar comments
@HeGaoYuan
Copy link

+1

@Dimss
Copy link

Dimss commented Dec 19, 2021

+1

@sonujose
Copy link

Same issue
golang - 1.16.9

@Thor-wl
Copy link

Thor-wl commented Dec 20, 2021

I've solved this problem by upgating golang to v1.17. Not sure whether it is a bug for v1.16 or not.

@HeGaoYuan
Copy link

HeGaoYuan commented Dec 20, 2021

Can it be solved by not upgating golang to v1.17?

@Thor-wl
Copy link

Thor-wl commented Dec 20, 2021

Unfortunately, I tried some ways but all failed.

@dineshputchala
Copy link

@Thor-wl Updating to

I've solved this problem by upgating golang to v1.17. Not sure whether it is a bug for v1.16 or not.

Updating to latest golang is solving this issue ?

@Thor-wl
Copy link

Thor-wl commented Jan 4, 2022

@Thor-wl Updating to

I've solved this problem by upgating golang to v1.17. Not sure whether it is a bug for v1.16 or not.

Updating to latest golang is solving this issue ?

Yes

@swiftslee
Copy link

cc

@ngood97-splunk
Copy link

I believe this is related: kubernetes-sigs/json#8

@Thor-wl
Copy link

Thor-wl commented Jan 24, 2022

I believe this is related: kubernetes-sigs/json#8

+1

@lmcdasm
Copy link

lmcdasm commented Jan 24, 2022

Same issue here, trying to bump golang version, but it causes massive refactor to lots of other components.

Any alternative options?

solonish added a commit to cert-manager/aws-privateca-issuer that referenced this issue Feb 11, 2022
* Upgraded logr version to v1.2.2, upgraded sigs.k8s.io/controller-runtime to v0.11.0 - kubernetes-sigs/controller-runtime#1607, upgraded cert-manager version to v1.7.1

Signed-off-by: Nishanth Solomon <solonish@amazon.com>

* Changed NullLogger to Discard - NullLogger is deprecated https://pkg.go.dev/github.com/go-logr/logr@v0.4.0/testing#NullLogger

Signed-off-by: Nishanth Solomon <solonish@amazon.com>

* Changed TestLogger to NewTestLogger - https://github.com/go-logr/logr/releases/tag/v1.1.0

Signed-off-by: Nishanth Solomon <solonish@amazon.com>

* Updated to golang:1.17 - kubernetes-sigs/controller-tools#643

Signed-off-by: Nishanth Solomon <solonish@amazon.com>
@ls-2018
Copy link

ls-2018 commented Feb 12, 2022

+1

@titaneric
Copy link

same here with Go version 1.16.5,

martin-g added a commit to martin-g/volcano that referenced this issue Feb 22, 2022
Related-to: kubernetes-sigs/json#8
Related-to: kubernetes-sigs/controller-tools#643

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
martin-g added a commit to martin-g/volcano that referenced this issue Feb 23, 2022
Related-to: kubernetes-sigs/json#8
Related-to: kubernetes-sigs/controller-tools#643

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
davidspek added a commit to pluralsh/kubeflow-profile-controller that referenced this issue Mar 1, 2022
@moluzhui
Copy link

The same problem is in go1.16, which lower version can solve this problem? Thanks

@dineshputchala
Copy link

Not observed this issue in v1.17.8

@davidlanouette
Copy link

davidlanouette commented Mar 16, 2022

reflect.StructField was added in go 1.17. If you are using it and compiling with an earlier version of go, you will have a bad time.

Edit:

MR #639 introduced a new version of sigs.k8s.io/json. That version requires go v1.17. That MR did bump the go version for controller-tools to v1.17. But, it looks like that change wasn't "documented" anywhere, so it's easy to understand why nobody knew that they needed to move to a newer version of go.

@dgloe-hpe
Copy link

dgloe-hpe commented Mar 29, 2022

The install guide for operator-sdk says that go 1.16 is required, is that not the case any more?
https://sdk.operatorframework.io/docs/building-operators/golang/installation/

@camilamacedo86
Copy link
Member

HI @dgloe-hpe,

The SDK will use go get to check this one, see https://github.com/operator-framework/operator-sdk/blob/master/testdata/go/v3/memcached-operator/Makefile#L150-L153 and inform the version.

So each SDK bin/release is compatible with which does.

The doc shared here is outdated because that should match with the latest release and the latest one uses go 1.17, see: https://github.com/operator-framework/operator-sdk/blob/v1.18.1/go.mod#L3

So, could you please raise an issue against the SDK repo asking for the doc be updated and have the info that the go version needs to be >= 1.17 < 1.18? Also, feel free to contribute with by pushing a PR. Your collab is very welcome.

@camilamacedo86
Copy link
Member

Regards this issue, controller-tools is using go 1.17 and have it solved. See its latest release 0.8.0: https://github.com/kubernetes-sigs/controller-tools/blob/v0.8.0/go.mod#L3

So, I am closing this one. however, if anyone need help in the future regards this one then please feel free to raise a new issue.

@zhaowei413
Copy link

the same issue with you on go 1.16. Fixed after upgrade to go1.18.....

saifshaikh48 added a commit to saifshaikh48/windows-machine-config-operator that referenced this issue Dec 2, 2022
Ran:
- go get github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned
- go mod tidy -go=1.17 && go mod vendor

Need to use go1.17 as go1.16 runs into kubernetes-sigs/controller-tools#643
tnierman pushed a commit to tnierman/backplane-cli that referenced this issue Mar 19, 2023
tnierman pushed a commit to tnierman/backplane-cli that referenced this issue Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests