Error in building packer from source - exec: "struct-markdown": executable file not found in $PATH

Hi,

I’m looking to build packer from source and specifically from the recent merge-vsphere-builder branch and I’m following the contribution guide from here

However, when I go and perform the make operation, it fails with bunch of errors stating struct-markdown isn’t in $PATH

2020/01/09 07:48:56 Generated command/plugin.go
common/bootcommand/config.go:1: running "struct-markdown": exec: "struct-markdown": executable file not found in $PATH
main.go:4: running "go": exit status 1
builder/alicloud/ecs/access_config.go:1: running "struct-markdown": exec: "struct-markdown": executable file not found in $PATH
builder/amazon/chroot/builder.go:1: running "struct-markdown": exec: "struct-markdown": executable file not found in $PATH
builder/amazon/common/access_config.go:1: running "struct-markdown": exec: "struct-markdown": executable file not found in $PATH
builder/amazon/ebs/builder.go:1: running "struct-markdown": exec: "struct-markdown": executable file not found in $PATH

I had assumed all required packages would be part of the setup but perhaps I’m missing something?

This is being ran on MacOS 10.14 (Mojave) and Go version go version go1.13.5 darwin/amd64

Any ideas what I might be doing wrong?

Building from source may be missing some of the needed dependencies (especially on a feature branch). A lot of the build make targets run on Ubuntu 18.04 so it could be an issue with macOS. Maybe try a go get for struct-markdown?

Threw the following:

└─[0] <git:(merge-vsphere-builder 6a2d73a0e✗✱) > go get
# github.com/hashicorp/packer/helper/communicator
helper/communicator/config.go:170:58: c.FlatMapstructure undefined (type *SSH has no field or method FlatMapstructure)
helper/communicator/config.go:171:58: c.FlatMapstructure undefined (type *WinRM has no field or method FlatMapstructure)
# github.com/hashicorp/packer/provisioner/sleep
provisioner/sleep/provisioner.go:20:64: p.FlatMapstructure undefined (type *Provisioner has no field or method FlatMapstructure)
provisioner/sleep/provisioner.go:22:58: p.FlatMapstructure undefined (type *Provisioner has no field or method FlatMapstructure)

Following the installation pattern from a similar install, the issue is likely that the install’s <…>/go/bin directory is not found in the PATH environment variable.

What that means is that some of the install files landed in your GOPATH or GOROOT folders. Find it by typing “go env”

Once you manually locate “struct-markdown” with “find / -name struct-markdown”

Update the PATH using “export PATH=$PATH:$GOPATH/bin” OR
whichever <…>/go/bin contains your “struct-markdown” file, i.e. “export PATH=$PATH:/root/go/bin”

I stumbled on the same problem.
After a bit of googling, I found the fix: https://github.com/hashicorp/packer/blob/master/Makefile#L52
from https://github.com/hashicorp/packer/blob/master/.github/CONTRIBUTING.md (why a CONTRIBUTING file hidden inside the .github/ directory? :thinking:)