Govendor fails during build from source

I’m referencing this page: https://gohugo.io/getting-started/installing/

Under this topic: Fetch from GitHub

go get github.com/kardianos/govendor
govendor get github.com/gohugoio/hugo
go install github.com/gohugoio/hugo

govendor installs just fine, but its usage fails like this:

$ govendor get github.com/gohugoio/hugo
Error: Package "/home/dewey/gocode\n/src/github.com/gohugoio/hugo" not a go package or not in GOPATH.

I’m assuming the “\n” is an issue here, but can’t figure out how to fix this. Suggestions?

I started seeing this about a week ago on Travis CI. Worked around it by doing this instead:

go get -u -v github.com/kardianos/govendor
go get -u -v github.com/gohugoio/hugo
(cd $GOPATH/src/github.com/gohugoio/hugo && govendor sync && go install)

i thought i was on track with your suggestion, but now see another issue:

gocode/src/github.com/gohugoio/hugo/commands/gendocshelper.go:61: enc.SetIndent undefined (type *json.Encoder has no field or method SetIndent)
(xenial)dewey@localhost:~$ echo $?
2

is this what happens when the source is in flux (and broken), such as during normal development cycle? or should this command be obtaining the latest stable/release?

yep, i’m new to go … jumping in specifically for the purposes of banging away at hugo.

You need >= Go 1.7.

krikey. i probably should have picked up on that myself. thanks!

FWIW, I was running into the govendor thing with go 1.8.

so … where does the fault lie? is that “\n” i pointed out something causing problems - and if so, where did it come from? or am i on the wrong track?

It sounds like what I suggested works around the \n issue, but you still need go ≥ 1.7 to fix the enc.SetIndent thing.

They are separate issues, and the \n thing still happens on 1.8, at least with some configurations.

understood. but i’m trying to wrap my head around what i’m seeing. is the “\n” something that comes in via metadata from the hugo source, something fishy with govendor, or is it an underlying go issue? i understand that you may now know …

Ah, yeah I don’t know :(. I’d be interested in that, too, though… I got the impression from googling for the problem while I was trying to work around it that it’s a govendor issue, but I’m not even sure of that, much less what the underlying cause is.

thanks for your responses; it’s good for a newbie to have someone decide not to ignore them … :slight_smile:

The “\n” issue is curious and I suspect you have that in your GOPATH os env.

As to building Hugo, I suggest you use make.

i’ve run through this 3 times from start to end in fresh chroots with the same “\n” issue. there is no newline character (or “\n” pair, either) that i can find anywhere.

in case it helps to know, i’m running this in an ubuntu 16.04 chroot on a chromebook.

but i’ve used the workaround from this thread and have an executable hugo binary now, so i’m happy.

thanks for your input!

The “\n” issue is curious and I suspect you have that in your GOPATH os env.

Nope. You can see in the link I posted above (line 468) that GOPATH doesn’t contain a newline. Furthermore, I just tried reinstalling hugo from scratch locally (Fedora 26), and I see the same issue.

https://github.com/kardianos/govendor/pull/352

2 Likes