profile
viewpoint

Ask questions`make bootstrap` fails because `scripts/install-codecgen.sh` assumes a copy of github.com/ugorji/go is checked out

On a fresh system, make bootstrap fails at make deps:

vagrant@node1:~/go/src/github.com/hashicorp/nomad$ make bootstrap
==> Updating build dependencies...
GO111MODULE=on go get -u github.com/kardianos/govendor
go: golang.org/x/sys upgrade => v0.0.0-20200406155108-e3b113bbe6a4
go: gopkg.in/yaml.v2 upgrade => v2.2.8
go: github.com/pkg/errors upgrade => v0.9.1
go: golang.org/x/net upgrade => v0.0.0-20200324143707-d3edc9973b7e
go: golang.org/x/tools upgrade => v0.0.0-20200406213809-066fd1390ee0
go: golang.org/x/text upgrade => v0.3.2
go: golang.org/x/crypto upgrade => v0.0.0-20200406173513-056763e48d71
go get -u github.com/hashicorp/go-bindata/go-bindata
go: found github.com/hashicorp/go-bindata/go-bindata in github.com/hashicorp/go-bindata v3.0.7+incompatible
go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
go: found github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs in github.com/elazarl/go-bindata-assetfs v1.0.0
GO111MODULE=on go get -u github.com/a8m/tree/cmd/tree
go: found github.com/a8m/tree/cmd/tree in github.com/a8m/tree v0.0.0-20181222104329-6a0b80129de4
GO111MODULE=on go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt
go: found github.com/magiconair/vendorfmt/cmd/vendorfmt in github.com/magiconair/vendorfmt v0.0.0-20170905193701-0fde667441eb
GO111MODULE=on go get -u gotest.tools/gotestsum
go: golang.org/x/crypto upgrade => v0.0.0-20200406173513-056763e48d71
go: github.com/spf13/pflag upgrade => v1.0.5
go: golang.org/x/net upgrade => v0.0.0-20200324143707-d3edc9973b7e
go: github.com/mattn/go-colorable upgrade => v0.1.6
go: golang.org/x/sys upgrade => v0.0.0-20200406155108-e3b113bbe6a4
go: github.com/sirupsen/logrus upgrade => v1.5.0
go: github.com/fatih/color upgrade => v1.9.0
go: github.com/mattn/go-isatty upgrade => v0.0.12
go: github.com/konsorten/go-windows-terminal-sequences upgrade => v1.0.2
go: github.com/pkg/errors upgrade => v0.9.1
go: golang.org/x/sync upgrade => v0.0.0-20200317015054-43a5402ce75a
GO111MODULE=on go get -u github.com/fatih/hclfmt
GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v1.3.4
go: found github.com/golang/protobuf/protoc-gen-go in github.com/golang/protobuf v1.3.4
Installing codec/codecgen@08f7b401aef15f3d544472dd46bf6788cdfe55bf ...
fatal: not a git repository (or any of the parent directories): .git
go: golang.org/x/tools upgrade => v0.0.0-20200406213809-066fd1390ee0
go: golang.org/x/xerrors upgrade => v0.0.0-20191204190536-9bdfabe68543
fatal: not a git repository (or any of the parent directories): .git
GNUmakefile:159: recipe for target 'deps' failed
make: *** [deps] Error 128
vagrant@node1:~/go/src/github.com/hashicorp/nomad$

I managed to trace it to scripts/install-codecgen.sh, and it looks like it assumes that you have a copy of github.com/ugorji/go/codec checked out at that specific location in your GOPATH; even if nothing else prior has checked it out there. These are the offending lines:

# Either fetch in existing git repo or use go get to clone
git -C "$(go env GOPATH)"/src/github.com/ugorji/go/codec fetch -q || go get -d -u github.com/ugorji/go/codec/codecgen
git -C "$(go env GOPATH)"/src/github.com/ugorji/go/codec checkout --quiet $GIT_TAG
go install github.com/ugorji/go/codec/codecgen

I managed to fix it by manually checking out the repo (github.com/ugorji/go) and then manually go install-ing myself... but this should be fixed. This is assuming that as per https://github.com/hashicorp/nomad/issues/2912#issuecomment-318440026, all I need is the binary, and github.com/ugorji/go doesnt really need to go under $GOPATH/src:

Hey @ethandrower,

Sorry I won't be able to give to great of advice but you do just need it in the path. By default it is installed under $GOPATH/bin. This is how go binaries get installed by default so it is worth just adding that to your path and then sourcing your bashrc/profile/etc and trying again!

Good luck!

hashicorp/nomad

Answer questions jf

Thanks, @notnoop . No, my nomad repo isn't outside GOPATH. I followed the README, and checked it out to $HOME/go/src/github.com/hashicorp/nomad. And I don't have GO111MODULE=on because the README (https://github.com/hashicorp/nomad#contributing-to-nomad) doesn't mention anything like that. I've got a VM, with go1.14.1 installed in $HOME/go (which is my $GOPATH)... and that's it, really.

useful!

Related questions

using `exec` driver result into RPC error hot 1
Cannot download private git repo with artifact stanza hot 1
[BUG] cannot allocate memory hot 1
Start Job button in UI breaks with Vault policies and allow_unauthenticated = false hot 1
[question]/[bug]? Consul Agent Default ACL token not used by Nomad Client - nomad hot 1
Allocation left in pending state after node lost hot 1
job still running though received kill signal hot 1
Allocation left running but task failing hot 1
[BUG] cannot allocate memory hot 1
Cannot use consul connect deployed through nomad with envoy proxy on centos 7 hot 1
Spread/affinity values in allocations may generate invalid JSON (and may not be working correctly) hot 1
[BUG] Allocs GC not work when Jobs is deleted by API. hot 1
Support Consul Connect with Consul TLS enabled hot 1
Tasks that are signaled to restart fail due to logmon errors hot 1
nomad stuck on (re)start hot 1
Github User Rank List