-
Notifications
You must be signed in to change notification settings - Fork 1.8k
panic: runtime error: index out of range, goroutine 89 [running] #1759
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
Comments
I use brew install operator-sdk. MacOs |
I am sorry to say that, '#1734' this didn't solve my problem. Then I change my GOROOT to '/usr/local/go', I still got this problem. It's panic at 'Created pkg/apis/asia/group.go'. I sign it use red frame. Then I try again, follow the issues #1765 I change my GOROOT to '/url/lib/golang', It panic at 'Created deploy/crds '. I sign it use red frame. Is there anything I didn't do correct or just the env promblem? |
Hi @YanRyan. Did you try it #1545 (comment) ? |
Yes, I try this. I reinstall go and the default location is '/usr/local/go' |
|
@YanRyan How are you installing go? If you use Homebrew to install If My advice is to make sure you only have one go installation on your system, in which case you should not have to explicitly set GOROOT. |
It drives me crazy. I use |
I install the go and operator-sdk in CentOS 7.5, then I create the project success. I think this the problem of my MacOs, maybe there still have env problem. Tanks all! |
I hit the similar issue on mac. Reinstalled go and operator-sdk, but still met the error:
Some info for my settings:
Any idea for fix it? Thanks. |
@mandymchu How did you install |
@joelanford Used |
I tried reinstalling go via |
Hmm I thought I was able to get things working originally on my Mac, but now I'm getting a panic trying all sorts of combinations of ways of installing Go and operator-sdk. I'm going to re-open this until we get to the bottom of this. @estroz @hasbro17 @theishshah @fabianvf @jmrodri Do any of you all have this working on a Mac? If so, what's your setup? @mandymchu Either way, your environment looks like it could be broken. Your GOROOT is My guess is that you have a self-installed Go (as you mentioned) but ALSO a Go installation from brew as a result of |
@joelanford After uninstall and reinstall, now |
This might be a go modules related issue. While I'm not getting the $ operator-sdk version
operator-sdk version: v0.9.0-50-g4ca881a9, commit: 4ca881a92eb71b19d4689065ae9bf4dcf9b43331
$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
INFO[0000] Generating api version app.example.com/v1alpha1 for kind AppService.
INFO[0000] Created pkg/apis/app/group.go
INFO[0005] Created pkg/apis/app/v1alpha1/appservice_types.go
INFO[0005] Created pkg/apis/addtoscheme_app_v1alpha1.go
INFO[0005] Created pkg/apis/app/v1alpha1/register.go
INFO[0005] Created pkg/apis/app/v1alpha1/doc.go
INFO[0005] Created deploy/crds/app_v1alpha1_appservice_cr.yaml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x18e98d5]
goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0003a20a0, 0xc000542300, 0x32, 0x2, 0x2)
pkg/mod/k8s.io/[email protected]/parser/parse.go:229 +0xb5
sigs.k8s.io/controller-tools/pkg/crd/generator.(*Generator).Do(0xc000729760, 0x0, 0x0)
pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/generator/generator.go:126 +0x3ac
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*CRD).CustomRender(0xc000268160, 0x2cff980, 0x4000ca0, 0x73f29d0, 0xc000268160, 0x1)
/Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/crd.go:102 +0x27e
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doRender(0xc000729cf8, 0xc0000b2270, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000058211, 0x29, ...)
/Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:222 +0x16c
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).doFile(0xc000729cf8, 0x2c85720, 0xc000268160, 0x0, 0x0)
/Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:192 +0x230
github.com/operator-framework/operator-sdk/internal/pkg/scaffold.(*Scaffold).Execute(0xc000729cf8, 0xc000729c68, 0xc000729c98, 0x6, 0x6, 0x0, 0x0)
/Users/haseeb/work/module-projects/operator-sdk/internal/pkg/scaffold/scaffold.go:157 +0x103
github.com/operator-framework/operator-sdk/cmd/operator-sdk/add.apiRun(0xc000570280, 0xc00000cc20, 0x0, 0x2, 0x0, 0x0)
/Users/haseeb/work/module-projects/operator-sdk/cmd/operator-sdk/add/api.go:118 +0x542
github.com/spf13/cobra.(*Command).execute(0xc000570280, 0xc00000cbc0, 0x2, 0x2, 0xc000570280, 0xc00000cbc0)
pkg/mod/github.com/spf13/[email protected]/command.go:762 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000f1b80, 0x2c88c00, 0xc000321e00, 0x0)
pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
/Users/haseeb/work/module-projects/operator-sdk/cmd/operator-sdk/main.go:85 +0x50f With Debugging this a bit more with the master branch to confirm. |
I still have this problem, I suggest that do not use "brew install |
@YanRyan @mandymchu Can you try uninstalling your brew-installed My current hypothesis is that there's something intrinsic in the |
Update: I can't reproduce the above runtime error anymore. $ operator-sdk version
operator-sdk version: v0.10.0, commit: ff80b17737a6a0aade663e4827e8af3ab5a21170
// Inside $GOPATH/src
$ pwd
/Users/haseeb/work/go-space/src/github.com/example-inc
$ GO111MODULE=on operator-sdk new app-operator
INFO[0000] Creating new Go operator 'app-operator'.
INFO[0000] Created go.mod
INFO[0000] Created tools.go
INFO[0000] Created cmd/manager/main.go
INFO[0000] Created build/Dockerfile
INFO[0000] Created build/bin/entrypoint
INFO[0000] Created build/bin/user_setup
INFO[0000] Created deploy/service_account.yaml
INFO[0000] Created deploy/role.yaml
INFO[0000] Created deploy/role_binding.yaml
INFO[0000] Created deploy/operator.yaml
INFO[0000] Created pkg/apis/apis.go
INFO[0000] Created pkg/controller/controller.go
INFO[0000] Created version/version.go
INFO[0000] Created .gitignore
INFO[0000] Validating project
go: finding github.com/operator-framework/operator-sdk master
INFO[0004] Project validation successful.
INFO[0004] Project creation complete.
// GO111MODULE=off inside $GOPATH now results in the correct error
$ cd app-operator/
$ GO111MODULE=off operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
FATA[0000] dependency manager "modules" requires working directory to be in $GOPATH/src and GO111MODULE=on, or outside of $GOPATH/src and GO111MODULE="on", "auto", or unset. More info: https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md#go-modules
$ GO111MODULE=on operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
INFO[0000] Generating api version app.example.com/v1alpha1 for kind AppService.
INFO[0000] Created pkg/apis/app/group.go
INFO[0002] Created pkg/apis/app/v1alpha1/appservice_types.go
INFO[0002] Created pkg/apis/addtoscheme_app_v1alpha1.go
INFO[0002] Created pkg/apis/app/v1alpha1/register.go
INFO[0002] Created pkg/apis/app/v1alpha1/doc.go
INFO[0002] Created deploy/crds/app_v1alpha1_appservice_cr.yaml
INFO[0010] Created deploy/crds/app_v1alpha1_appservice_crd.yaml
INFO[0010] Running deepcopy code-generation for Custom Resource group versions: [app:[v1alpha1], ]
INFO[0018] Code-generation complete.
INFO[0018] Running OpenAPI code-generation for Custom Resource group versions: [app:[v1alpha1], ]
INFO[0034] Created deploy/crds/app_v1alpha1_appservice_crd.yaml
INFO[0034] Code-generation complete.
INFO[0034] API generation complete. Same for the version that I initially tested out with Not entirely sure what I changed or how I managed to run |
@joelanford @hasbro17 I uninstalled brew-installed operator-sdk and installed it from Github release, also confirmed that BTW: it works on redhat, and no need to export GOROOT manually. |
@joelanford @hasbro17 In my macOS(installed go and operator-sdk by brew), I reproduce this issue. But when I uninstall operator-sdk and make install from source in master(abac23c), it works well. So I think maybe we need to release one new version for this. Any thoughts? |
@jiwq @YanRyan @camilamacedo86 I think I've got this one finally figured out. See #1854 (comment) |
I still get
Have reinstalled Go, reinstalled operator-sdk. Nothing works. Please help! |
Hello, I got this problem when I use

operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
I just follow the ReadMe, Quick Start.

The text was updated successfully, but these errors were encountered: