Unable to build Hugo master branch locally [v0.55+]

Hello,

I am unable to build Hugo locally.

First I got these errors:

common/maps/maps.go:19:2: cannot find package "github.com/gobwas/glob" in any of:
        /home/kmodi/go/src/github.com/gobwas/glob (from $GOROOT)
        /home/kmodi/go.apps/src/github.com/gobwas/glob (from $GOPATH)
helpers/general.go:36:2: cannot find package "github.com/jdkato/prose/transform" in any of:
        /home/kmodi/go/src/github.com/jdkato/prose/transform (from $GOROOT)
        /home/kmodi/go.apps/src/github.com/jdkato/prose/transform (from $GOPATH)
helpers/processing_stats.go:21:2: cannot find package "github.com/olekukonko/tablewriter" in any of:
        /home/kmodi/go/src/github.com/olekukonko/tablewriter (from $GOROOT)
        /home/kmodi/go.apps/src/github.com/olekukonko/tablewriter (from $GOPATH)
Error: error compiling magefiles

To get around those, I cloned those 3 repos in my $GOROOT and tried building again. But then I got these errors:

# github.com/gohugoio/hugo/config
config/configLoader.go:52:3: v.MergeConfigMap undefined (type *viper.Viper has no field or method MergeConfigMap)
config/configLoader.go:66:9: v.MergeConfigMap undefined (type *viper.Viper has no field or method MergeConfigMap)
Error: error compiling magefiles

Any pointers to how to fix these?


Using go1.12

Update: Using go1.12.2

It looks like doing the usual go build .. to build Hugo is not auto-updating (cloning if needed or pulling) all the dependencies … any idea why that would happen?

I suggest you clone Hugo somewhere OUTSIDE of your GOPATH.

1 Like

Thanks! That worked like a charm … so no more building Go apps in ~/go.apps/src/...

Note that they have slowly introduced Go Modules in Go 1.11 and now for full in Go 1.12 – which is probably why you see the troubles now in Go 1.12 …

Hey, i am a newbie. I am experiencing the same issue :
package github.com/jdkato/prose/transform: cannot find package “github.com/jdkato/prose/transform” in any of:
this error log shows up and thus i am unable to import hugo and deps packages as modules in golang. Please help.

I am experiencing this same problem.

I uninstalled and reinstalled hugo using snap, and it solved the problem.
snap remove hugo
snap install hugo --channel=extended a