Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: error installing gopls and multiple x/tools packages on arm #35137

Closed
thatnerdjosh opened this issue Oct 24, 2019 · 11 comments
Closed

cmd/go: error installing gopls and multiple x/tools packages on arm #35137

thatnerdjosh opened this issue Oct 24, 2019 · 11 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@thatnerdjosh
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.13.3 linux/arm

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
AR="ar"
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 -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build596311221=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Passing command:

    GO111MODULE=on go get -buildmode=exe -ldflags '-s -w'   \
      golang.org/x/tools/gopls@latest

Failing command:

    GO111MODULE=on go get -buildmode=exe -ldflags '-s -w'   \
      golang.org/x/tools/gopls@latest                       \
      golang.org/x/tools/cmd/benchcmp # OR add any other x/tools package

What did you expect to see?

Success for gopls even if other x/tools packages brought in

What did you see instead?

pkg/mod/golang.org/x/tools/gopls@v0.1.7/main.go:20:41: not enough arguments in call to cmd.New
	have (string, string, nil)
	want (string, string, []string, func(*source.Options))
@gopherbot gopherbot added this to the Unreleased milestone Oct 24, 2019
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Oct 24, 2019
@stamblerre
Copy link
Contributor

Are you running this command inside of a module? Make sure to switch to a temporary directory before running the command.

@golang golang deleted a comment from gopherbot Oct 24, 2019
@thatnerdjosh
Copy link
Author

thatnerdjosh commented Oct 24, 2019

Yes, I am running from a temp dir, it is an empty docker container based on arm32v7/golang:latest

Edit:
Tested on the base OS itself just in case it's some docker weirdness, and I get the same result

@stamblerre
Copy link
Contributor

Could you try running with -v to get a bit more information? You could also try clearing the module cache and running the command again.

@thatnerdjosh
Copy link
Author

-v gives no additional information, I think the error is pretty clear, just haven't dug much more into it... I can look into this more if need be. I figure also, since I am making a new docker container, that shouldn't have any module cache

Thanks!

@stamblerre
Copy link
Contributor

Oh I'm sorry I misread your initial issue - I thought both of those commands were failing.

I think I would expect this to fail. gopls is a sub-module of x/tools, and therefore latest depends on a specific version of x/tools. golang.org/x/tools/cmd/benchcmp is downloaded at master, however, causing the conflict.

I might be mistaken though -- @jayconrod: should this work?

@thatnerdjosh
Copy link
Author

@stamblerre that makes sense... one question I have is why would this work on amd64 and not arm?

@stamblerre stamblerre changed the title x/tools/gopls: Error installing on arm with other x/tools packages cmd/go: error installing multiple gopls and x/tools packages on arm Oct 24, 2019
@stamblerre stamblerre changed the title cmd/go: error installing multiple gopls and x/tools packages on arm cmd/go: error installing gopls and multiple x/tools packages on arm Oct 24, 2019
@stamblerre
Copy link
Contributor

I was unable to get it to work on amd64, but I'm definitely not knowledgeable enough here to have useful insight. Probably best to wait for advice from the go command folks.

@thatnerdjosh
Copy link
Author

Oh, I know what the issue is, I had an old build for the amd64 one that was cached... there have since been api changes, I think your original hunch was right, going to try that :)

@thatnerdjosh
Copy link
Author

Same issue with:

GO111MODULE=on go get -buildmode=exe -ldflags '-s -w'      \
>       golang.org/x/lint/golint                                 \
>       golang.org/x/tools@latest                                \
>       golang.org/x/tools/gopls@latest                          \

@jayconrod
Copy link
Contributor

Working as intended from the go command perspective: this command may not work in general. It's probably best to run one go get command per module.

This command requests the latest version of golang.org/x/tools/gopls (v0.1.7 as of now) built against the latest version of golang.org/x/tools (v0.0.0-20191024172055-b24f3822ec91), which is a separate module. gopls v0.1.7 depends on an internal package in x/tools, golang.org/x/tools/internal/lsp/cmd. There have been incompatible changes in the API of that internal package, so gopls v0.1.7 doesn't build. Presumably gopls at master works with those changes, but v0.1.7 does not.

Another way to reproduce:

mkdir test
cd test
go mod init m
go get -d golang.org/x/tools/gopls
go get -d golang.org/x/tools
go build golang.org/x/tools/gopls

@stamblerre
Copy link
Contributor

Since it looks like this is intended behavior, I will close the issue.

@golang golang locked and limited conversation to collaborators Oct 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants