Can't build from source; golang complains about GOPROXY

Hey folks, I abandoned my quest to build hugo on account of some personal life complexity. I’m coming back to try to ship the feature of adding time offsets to the youtube shortcode.

Again, though, I’m stymied building hugo from source. Per Linux | Hugo

  1. git version 2.39.2
  2. go version => go version go1.22.0 linux/amd64
  3. gcc --version => $ gcc --version gcc (Debian 12.2.0-14) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  4. which go => $ which go
    /usr/local/src/go/bin/go (installed as per Download and install - The Go Programming Language)

For good measure:

$ env |grep GO
GOROOT=/usr/bin
GOPATH=/var/go

OK so…

$ CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
go: github.com/gohugoio/hugo@latest: GOPROXY list is not the empty string, but contains no entries

Huh. What if i set GOPROXY to empty string?

 if [ -z "$GOPROXY" ]; then echo empty; fi
empty

Same thing. I can’t seem to get hugo built and, more importantly, get the test cases to run. My goal is to get a build to build and the extant test suite to run. Am I missing a configuration step?

I suspect your Go installation/config is… not what you want.

On a virgin Debian bookworm system I installed git, Go, and build-essential.

git version
# git version 2.39.2

go version
# go version go1.22.0 linux/amd64

gcc --version
# gcc (Debian 12.2.0-14) 12.2.0

CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest

No problems.

This is how I installed Go:

  1. Add this section to $HOME/.bashrc:

    # Set PATH to include $HOME/go/bin if it exists.
    if [ -d "$HOME/go/bin" ]; then
      PATH="$HOME/go/bin:$PATH"
    fi
    
  2. Install:

    sudo snap install go --channel=1.22/stable --classic
    
  3. Open a new console so that .bashrc is sourced again.

This is a machine I built from scratch last weekend so it’s got fairly minimal stuff installed.

  • Same version git
  • Same go version
  • Same version of GCC

Invoking the installation chant still gets me noise about GOPROXY not being set.

I was inspired by `go install` fails when `GOPROXY` is empty · Issue #62274 · golang/go · GitHub and set GOPROXY. That DOES resolve the error. But now things break on “verifying module: missing GOSUMDB”.

The one difference is that I don’t have snap installed … but i’m not sure I really want to install some other tool that I only dimly understand. AFAICT, installing go is:

  1. expand the archive
  2. move it into /usr/local
  3. then put the bin subdir in your PATH

That’s fine, that’s easy. I do that nearly every day.

That’s also the instructions that I copied from Google. I don’t see what I could have messed up here to create this wild goose chase of an error.

Me neither. I’d start over.

I worked on this with a friend from work and he suggested that I unset GOROOT. Doing so stopped the error about GOPROXY. Why the heck a go env var situation should cause a complaint in GOPROXY is beyond me.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.