Compile nomad from source


I am trying to compile nomad from source, and running into these errors.
If anyone can help or have previously faced similar issues.


Nomad location: $GOPATH/src/

smahajan@smahajan-VirtualBox:~/go/src/$ make bootstrap
==> Updating build dependencies...
go get -u
go get -u
go get -u
go get -u
go get -u
go get -u
go get -u
Installing codec/codecgen@08f7b401aef15f3d544472dd46bf6788cdfe55bf ...
Installing protobuf/protoc-gen-go@v1.2.0 ...
==> Updating linter dependencies...
go get -u
go get -u
smahajan@smahajan-VirtualBox:~/go/src/$ echo $?
smahajan@smahajan-VirtualBox:~/go/src/$ make dev
--> Formatting vendor/vendor.json
test -x /home/smahajan/go/bin/vendorfmt || go get -u
bash: vendorfmt: command not found
GNUmakefile:211: recipe for target 'vendorfmt' failed
make: *** [vendorfmt] Error 127
smahajan@smahajan-VirtualBox:~/go/src/$ echo $?

Thanks in advance!

Looks like vendorfmt and hclfmt needs to be compiled and installed as well.
Just doing a go get doesn’t work.

Just putting the steps here, if anyone else also faces a similar issue:

  1. go get -u
  2. go get
  3. Go to your $GOPATH where these packages are downloaded, and compile them from source:
    go build -o vendorfmt main.go and go build -o hclfmt main.go
  4. move the binaries to /usr/bin

Now the nomad compilation should work!

Hi @shishir-a412ed! I think this is the hint of what’s wrong:

When you’re working on go projects, you should make sure that $GOPATH/bin is on your $PATH. The go get -u will have installed the vendorfmt binary to $GOPATH/bin/vendorfmt.

1 Like

@tgross Perfect! That’s probably the right way to do it. Thanks for the help!