Go deps in preBuild
gregistech opened this issue · comments
Is your feature request related to a problem? Please describe.
I want to generate some files with go but the dependencies are needed for it.
Describe the solution you'd like
Somehow be able to access go deps in the preBuild
phase.
Describe alternatives you've considered
Completely rewriting buildPhase
in my flake. Kinda a bad solution.
Tried adding a postGo
hook, but the same issue arises. Is the problem with using go generate generate.go
?
When I run go generate generate.go
in nix develop
I see:
go: downloading golang.org/x/tools v0.1.10
go: downloading golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
I realised that generate.go is just a glorified bash script. I ran them manually. I also need to build a Go project to get a binary needed for even more generation. That gives me these errors:
+ go build .
../protoc-base/templates.go:9:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/github.com/Masterminds/sprig
../protoc-base/protoc_helper.go:12:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/github.com/golang/glog
../protoc-base/protoc_helper.go:13:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/github.com/golang/protobuf/proto
../protoc-base/protoc_helper.go:14:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/github.com/golang/protobuf/protoc-gen-go/>
../protoc-base/protoc_helper.go:15:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/github.com/grpc-ecosystem/grpc-gateway/pr>
../protoc-base/templates.go:12:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/golang.org/x/tools/imports
authoption/options.pb.go:10:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/google.golang.org/protobuf/reflect/protor>
authoption/options.pb.go:11:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/google.golang.org/protobuf/runtime/protoi>
authoption/options.pb.go:12:2: cannot find package "." in:
/build/source/gopath/src/github.com/zitadel/zitadel/vendor/google.golang.org/protobuf/types/descript>
/build/source/gopath/src/github.com/zitadel/zitadel /build/source
Maybe I should try making a whole new derivation for this binary. That sounds like the good pathway. If that works, this whole issue is resolved.
I did it the above mentioned way.