I tried building Hugo on Windows from last version with “go install hugo” and I get several errors such as:
C:\go_code\src\hugo>go install hugo
main.go:19:2: cannot find package “github.com/spf13/hugo/commands” in any of:
C:\go_code\src\hugo\vendor\github.com\spf13\hugo\commands (vendor tree)
C:\Go\src\github.com\spf13\hugo\commands (from $GOROOT)
C:\go_code\src\github.com\spf13\hugo\commands (from $GOPATH)
I can correct these errors manually by editing lines calling packages in .go files such as:
“github.com/spf13/hugo/helpers”
To:
“hugo/helpers”
My exact commands were:
cd go_code/src/hugo
govendor sync
go install hugo
I notice that these changes are done in vendor.json after “govendor sync”:
If you forked it, it may have ended up in the “wrong” directory under GOPATH. The trick is to make sure it lives in $GOPATH\src\hugo\vendor\github.com\spf13\hugo.
Open a cmd at “C:\go_code\src\github.com\spf13\hugo”
input in the cmd: govendor sync
input in the cmd: go install github.com\spf13\hugo
That alternative install with govendor seems cleaner as it doesn’t pollute the GOPATH folder with all of hugo’s dependencies (they are installed under “hugo/vendor” instead).
I believe this install method hasn’t been supported in all versions (as govendor support seems to have been added a few months ago), but is it a supported install method?
If that’s the case, I suggest adding it as maybe “Option 2” under “Build and Install the Binaries from Source (Advanced Install)” at:
(*) A note should probably be added with a mention that it’s supported as of version xyz.