controller-tools: install controller-gen failed: sf.IsExported undefined
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 38
- Comments: 22 (2 by maintainers)
Commits related to this issue
- Update logr dependency (#122) * Upgraded logr version to v1.2.2, upgraded sigs.k8s.io/controller-runtime to v0.11.0 - https://github.com/kubernetes-sigs/controller-runtime/issues/1607, upgraded cert-... — committed to cert-manager/aws-privateca-issuer by solonish 2 years ago
- Upgrade Golang to 1.17.7 Related-to: https://github.com/kubernetes-sigs/json/issues/8 Related-to: https://github.com/kubernetes-sigs/controller-tools/issues/643 Signed-off-by: Martin Tzvetanov Grigo... — committed to martin-g/volcano by martin-g 2 years ago
- Upgrade Golang to 1.17.7 Related-to: https://github.com/kubernetes-sigs/json/issues/8 Related-to: https://github.com/kubernetes-sigs/controller-tools/issues/643 Signed-off-by: Martin Tzvetanov Grigo... — committed to martin-g/volcano by martin-g 2 years ago
- bump to Go 1.17. see https://github.com/kubernetes-sigs/controller-tools/issues/643 — committed to pluralsh/kubeflow-profile-controller by davidspek 2 years ago
- update project to go 1.17 because of compilation issues see https://github.com/kubernetes-sigs/controller-tools/issues/643#issuecomment-1069091536 — committed to linki/chaoskube by linki 2 years ago
- [vendor] Vendor dependencies for OLM clientset 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 ... — committed to saifshaikh48/windows-machine-config-operator by saifshaikh48 2 years ago
- backplane-cli requires go 1.17+ due to https://github.com/kubernetes-sigs/controller-tools/issues/643 Signed-off-by: Michael Shen <mshen@redhat.com> — committed to tnierman/backplane-cli by mjlshen 2 years ago
- backplane-cli requires go 1.17+ due to https://github.com/kubernetes-sigs/controller-tools/issues/643 Signed-off-by: Michael Shen <mshen@redhat.com> — committed to tnierman/backplane-cli by mjlshen 2 years ago
I’ve solved this problem by upgating golang to v1.17. Not sure whether it is a bug for v1.16 or not.
Same issue here, trying to bump golang version, but it causes massive refactor to lots of other components.
Any alternative options?
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 forcontroller-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.