code-generator: the default value of GoHeaderFilePath is wrong
the problem is in this commit https://github.com/kubernetes/code-generator/commit/5bb9f2e1767e5cb98bb373649a1da739aa7cb4ff
before: the default GoHeaderFilePath is filepath.Join(args.DefaultSourceTree(), path.Join(reflect.TypeOf(empty{}).PkgPath(), “/…/…/hack/boilerplate.go.txt”))
after: the default GoHeaderFilePath is just filepath.Join(reflect.TypeOf(empty{}).PkgPath(), “/…/…/hack/boilerplate.go.txt”) the args.DefaultSourceTree() is missing
use the latest code,the generate-groups.sh can only run in ${GOPATH}/k8s.io/code-generator/
otherwise will panic like this
F0812 02:47:30.269045 68831 deepcopy.go:131] Failed loading boilerplate: open : no such file or directory
goroutine 1 [running]:
k8s.io/klog/v2.stacks(0xc000010001, 0xc000aff680, 0x6c, 0xbc)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:1026 +0xb9
k8s.io/klog/v2.(*loggingT).output(0x1619ba0, 0xc000000003, 0x0, 0x0, 0xc0000129a0, 0x0, 0x15f080c, 0xb, 0x83, 0x0)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:975 +0x1f1
k8s.io/klog/v2.(*loggingT).printf(0x1619ba0, 0xc000000003, 0x0, 0x0, 0x0, 0x0, 0x13d8852, 0x1e, 0xc0026122c0, 0x1, ...)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:753 +0x19a
k8s.io/klog/v2.Fatalf(...)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:1514
k8s.io/gengo/examples/deepcopy-gen/generators.Packages(0xc0002e1810, 0xc00011d040, 0x13b4e22, 0x6, 0xc0002e1810)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/gengo@v0.0.0-20201214224949-b6c5ce23f027/examples/deepcopy-gen/generators/deepcopy.go:131 +0x135
k8s.io/gengo/args.(*GeneratorArgs).Execute(0xc00011d040, 0xc0023bfe38, 0x13b4e22, 0x6, 0x13e4650, 0x0, 0x0)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/gengo@v0.0.0-20201214224949-b6c5ce23f027/args/args.go:206 +0x1a9
main.main()
/Users/zhaohui/workspace/project/go/src/k8s.io/code-generator/cmd/deepcopy-gen/main.go:75 +0x42b
goroutine 6 [chan receive]:
k8s.io/klog/v2.(*loggingT).flushDaemon(0x1619ba0)
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:1169 +0x8b
created by k8s.io/klog/v2.init.0
/Users/zhaohui/workspace/project/go/pkg/mod/k8s.io/klog/v2@v2.9.0/klog.go:420 +0xdf
because the method util.BoilerplatePath() just return an empty string.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 20
I faced the same issue today. Any suggestions to fix it?
Just a heads up that I believe I ran into this issue today.