kubernetes-sigs / kubebuilder

Kubebuilder - SDK for building Kubernetes APIs using CRDs
http://book.kubebuilder.io
Apache License 2.0
7.77k stars 1.43k forks source link

Kubebuilder init fails for crypto/tls #1774

Closed raonadeem closed 3 years ago

raonadeem commented 3 years ago

I'm trying to initialize the Kubebuilder project with the following commands and getting the errors;

kubebuilder init --domain example.com --license apache2 --owner "The Kubernetes authors"

Writing scaffold for you to edit... Get controller runtime: $ go get sigs.k8s.io/controller-runtime@v0.5.0 crypto/tls ../crypto/tls/key_schedule.go:114:30: undefined: curve25519.ScalarSize ../crypto/tls/key_schedule.go:118:21: undefined: curve25519.X25519 ../crypto/tls/key_schedule.go:118:51: undefined: curve25519.Basepoint ../crypto/tls/key_schedule.go:194:20: undefined: curve25519.X25519 2020/11/03 15:19:05 failed to initialize project: exit status 2

Following are my package versions;

camilamacedo86 commented 3 years ago

Hi @raonadeem,

The version 2.3.1 requires the go version 1.13. Also, it might be related to your local configuration as well. So, if you would like to use go version 1.15 I'd like to recommend you use the master branch instead of the released version. In this way, could you please;

And then, if you still facing issues could you please provide the output of go env for we are able to check and see if we can find something that is missing to help you with?

We are looking for your reply.

raonadeem commented 3 years ago

Hi @camilamacedo86 ,

The issue is resolved if I initialize the go mod;

go mod init 'modulename'

But, I'm working in GOPATH and don't know why it needs go mod init.

pwd /usr/local/go/src/nadeem

Following are my go env;

go env

GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/usr/local/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/usr/local/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/usr/local/go/src/nadeem/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build231577266=/tmp/go-build -gno-record-gcc-switches"

camilamacedo86 commented 3 years ago

So, you are creating the project outside of the GOPATH. Am right? If yes, you need to use the --repo flag to describe the module or run go mod init before. See: https://book.kubebuilder.io/quick-start.html#not-in-gopath .It is described in the docs. So, shows fine we close this one. Please, let me know if you see any reason for we keep this one open.

raonadeem commented 3 years ago

I'm In GOPATH as here;

pwd /usr/local/go/src/nadeem

mkdir $GOPATH/src/nadeem cd $GOPATH/src/nadeem kubebuilder init --domain my.domain

And getting the same error as above.

camilamacedo86 commented 3 years ago

Hi @raonadeem,

It shows to be related to the go version used. See that for 2.3.1 it requires to go 1.13. In this way, shows fine we close this one. However, please feel free to ping us to re-open this one if you need.