Upgrade to Go1.12.7 problem

667 views
Skip to first unread message

Shane H

unread,
Aug 5, 2019, 8:56:42 PM8/5/19
to golang-nuts
Hi all,

I've done a bit of searching, and asked around, but not found an answer to my (most likely self-inflicted) problem.

I have been coding with Go 1.10 and 1.11 for a whiles, but I decided that it was time to join the future and upgraded to 1.12. It worked fine for the project I was creating at the time, but after some time (long enough for me to forget the steps I took to upgrade!) I discovered issues with my install.

I've tried to reinstall (Ubuntu, apt purge golang-1.* ) and reinstall, to no avail.

I need to know what I can check to stop this behaviour, sans reinstalling the OS

This is probably best demonstrated as:
shane@desktop ~/GoLang/src/github.com/ipfs/go-ipfs (master) $ make build
go version go1.12.7 linux/amd64
bin/check_go_version 1.12
go build  "-asmflags=all='-trimpath=/home/shane/GoLang'" "-gcflags=all='-trimpath=/home/shane/GoLang'" -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=641d9f6b0-dirty" -o "cmd/ipfs/ipfs" "github.com/ipfs/go-ipfs/cmd/ipfs"
/usr/local/go/src/crypto/tls/cipher_suites.go:18:2: unknown import path "golang_org/x/crypto/chacha20poly1305": cannot find module providing package golang_org/x/crypto/chacha20poly1305
/usr/local/go/src/crypto/x509/x509.go:36:2: unknown import path "golang_org/x/crypto/cryptobyte": cannot find module providing package golang_org/x/crypto/cryptobyte
/usr/local/go/src/crypto/x509/x509.go:37:2: unknown import path "golang_org/x/crypto/cryptobyte/asn1": cannot find module providing package golang_org/x/crypto/cryptobyte/asn1
/usr/local/go/src/crypto/tls/key_agreement.go:18:2: unknown import path "golang_org/x/crypto/curve25519": cannot find module providing package golang_org/x/crypto/curve25519
/usr/local/go/src/net/dnsclient.go:11:2: unknown import path "golang_org/x/net/dns/dnsmessage": cannot find module providing package golang_org/x/net/dns/dnsmessage
/usr/local/go/src/net/http/h2_bundle.go:47:2: unknown import path "golang_org/x/net/http/httpguts": cannot find module providing package golang_org/x/net/http/httpguts
/usr/local/go/src/net/http/transport.go:34:2: unknown import path "golang_org/x/net/http/httpproxy": cannot find module providing package golang_org/x/net/http/httpproxy
/usr/local/go/src/net/http/h2_bundle.go:48:2: unknown import path "golang_org/x/net/http2/hpack": cannot find module providing package golang_org/x/net/http2/hpack
/usr/local/go/src/net/http/h2_bundle.go:49:2: unknown import path "golang_org/x/net/idna": cannot find module providing package golang_org/x/net/idna
cmd/ipfs/Rules.mk:22: recipe for target 'cmd/ipfs/ipfs' failed
make: *** [cmd/ipfs/ipfs] Error 1


$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/shane/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/shane/GoLang"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build529069743=/tmp/go-build -gno-record-gcc-switches"


The issue is now showing up in my vim, golangci-lint is complaining of errors
/usr/local/go/src/net/dnsclient.go|11 col 2| could not import golang_org/x/net/dns/dnsmessage (invalid package name: "")

Shane H

unread,
Aug 5, 2019, 9:31:40 PM8/5/19
to golang-nuts
When I try to upgrade my gopls server I get
$ env GO111MODULE=on go get golang.org/x/tools/gopls@latest
go: finding golang.org/x/tools/gopls v0.1.3
go: finding golang.org/x/tools v0.0.0-20190710153321-831012c29e42
go: finding golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: downloading golang.org/x/tools v0.0.0-20190710153321-831012c29e42
go: extracting golang.org/x/tools v0.0.0-20190710153321-831012c29e42
go: downloading golang.org/x/tools/gopls v0.1.3
go: extracting golang.org/x/tools/gopls v0.1.3
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
# errors
compile: version "go1.11" does not match go tool version "go1.12.7"
# runtime/internal/sys
compile: version "go1.11" does not match go tool version "go1.12.7"
# internal/race
compile: version "go1.11" does not match go tool version "go1.12.7"
# runtime/internal/atomic
flag provided but not defined: -gensymabis
usage: asm [options] file.s ... 

Shane H

unread,
Aug 5, 2019, 9:58:03 PM8/5/19
to golang-nuts

Crisis over

I discovered that /usr/local/go was still version 1.11 for whatever reason Ubuntu did not update that directory when I installed go via apt/dpkg

I therefore downloaded  https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz into /tmp, decompressed it, then moved the go/ directory to /usr/local (moving the old version to /usr/local/go-1.11 just in case)


Ian Lance Taylor

unread,
Aug 6, 2019, 12:21:18 AM8/6/19
to Shane H, golang-nuts
On Mon, Aug 5, 2019 at 5:56 PM Shane H <shan...@gmail.com> wrote:
>
> I've done a bit of searching, and asked around, but not found an answer to my (most likely self-inflicted) problem.
>
> I have been coding with Go 1.10 and 1.11 for a whiles, but I decided that it was time to join the future and upgraded to 1.12. It worked fine for the project I was creating at the time, but after some time (long enough for me to forget the steps I took to upgrade!) I discovered issues with my install.
>
> I've tried to reinstall (Ubuntu, apt purge golang-1.* ) and reinstall, to no avail.
>
> I need to know what I can check to stop this behaviour, sans reinstalling the OS
>
> This is probably best demonstrated as:
> shane@desktop ~/GoLang/src/github.com/ipfs/go-ipfs (master) $ make build
> go version go1.12.7 linux/amd64
> bin/check_go_version 1.12
> go build "-asmflags=all='-trimpath=/home/shane/GoLang'" "-gcflags=all='-trimpath=/home/shane/GoLang'" -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=641d9f6b0-dirty" -o "cmd/ipfs/ipfs" "github.com/ipfs/go-ipfs/cmd/ipfs"
> /usr/local/go/src/crypto/tls/cipher_suites.go:18:2: unknown import path "golang_org/x/crypto/chacha20poly1305": cannot find module providing package golang_org/x/crypto/chacha20poly1305
> /usr/local/go/src/crypto/x509/x509.go:36:2: unknown import path "golang_org/x/crypto/cryptobyte": cannot find module providing package golang_org/x/crypto/cryptobyte
> /usr/local/go/src/crypto/x509/x509.go:37:2: unknown import path "golang_org/x/crypto/cryptobyte/asn1": cannot find module providing package golang_org/x/crypto/cryptobyte/asn1
> /usr/local/go/src/crypto/tls/key_agreement.go:18:2: unknown import path "golang_org/x/crypto/curve25519": cannot find module providing package golang_org/x/crypto/curve25519
> /usr/local/go/src/net/dnsclient.go:11:2: unknown import path "golang_org/x/net/dns/dnsmessage": cannot find module providing package golang_org/x/net/dns/dnsmessage
> /usr/local/go/src/net/http/h2_bundle.go:47:2: unknown import path "golang_org/x/net/http/httpguts": cannot find module providing package golang_org/x/net/http/httpguts
> /usr/local/go/src/net/http/transport.go:34:2: unknown import path "golang_org/x/net/http/httpproxy": cannot find module providing package golang_org/x/net/http/httpproxy
> /usr/local/go/src/net/http/h2_bundle.go:48:2: unknown import path "golang_org/x/net/http2/hpack": cannot find module providing package golang_org/x/net/http2/hpack
> /usr/local/go/src/net/http/h2_bundle.go:49:2: unknown import path "golang_org/x/net/idna": cannot find module providing package golang_org/x/net/idna
> cmd/ipfs/Rules.mk:22: recipe for target 'cmd/ipfs/ipfs' failed
> make: *** [cmd/ipfs/ipfs] Error 1

This looks like you unpacked a Go distribution into a directory that
already held another Go distribution. Always unpack a Go distribution
into an empty directory.

Ian

Shane H

unread,
Aug 6, 2019, 6:52:49 PM8/6/19
to golang-nuts

This looks like you unpacked a Go distribution into a directory that
already held another Go distribution.  Always unpack a Go distribution
into an empty directory.

Ian

You could well be right, I think (from my perspective) the bigger issue is managing a Go installation on Ubuntu.

The binary was updated correctly but, for whatever reason, the distribution? wasn't touched, not by the install, not by the purge. 

It was only that I found a helpful page dealing with a similar complaint, by googling the later error "does not match go tool version", that I discovered that the distribution was out of sync with the binary.

It can't be affecting too many other people, else I would have found more pages of people looking for help with the first error, before posting here.

Gerald Henriksen

unread,
Aug 9, 2019, 10:56:48 AM8/9/19
to Shane H, golang-nuts
On Mon, 5 Aug 2019 18:58:02 -0700 (PDT), you wrote:

>I discovered that /usr/local/go was still version 1.11 for whatever reason
>Ubuntu did not update that directory when I installed go via apt/dpkg

This is correct behaviour, see below.

>I therefore downloaded
>https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz into /tmp,
>decompressed it, then moved the go/ directory to /usr/local (moving the old
>version to /usr/local/go-1.11 just in case)

In general it is a bad idea to mix both self-installed and
distribution packaged versions of the same program unless you are
aware of what you are doing and the likely repurcussions.

If you are now using the version of Go that you downloaded and self
installed (as indicated above) then make sure you have used apt/dpkg
to remove the Ubuntu version that you installed in the past.

More generally, distribution packages (whether apt/dpkg/rpm) do not
install into /usr/local and thus installing the Ubuntu version of Go
would not touch anything in /usr/local because, as the name suggests,
/usr/local is meant for stuff the user has installed outside of the
distribution package management system.

So if you want to switch from self installed to the Ubuntu packaged
version of Go, then it is up to you to clean up /usr/local of any
previous non-dpkg installs of Go.
Reply all
Reply to author
Forward
0 new messages