Skip to content

x/tools/gopls: could not import github.com/google/trillian (no parsed files for package github.com/google/trillian) #32903

@DazWilkin

Description

@DazWilkin

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

$ go version
go version go1.12.5 linux/amd64

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
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/trillian/go"
GOROOT="/usr/lib/google-golang"
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build732986152=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Updated VS Code settings per instructions:
https://github.com/Microsoft/vscode-go/wiki/Go-modules-support-in-Visual-Studio-Code
https://github.com/golang/go/wiki/gopls#vscode

{
    "go.useLanguageServer": true,
    "[go]": {
        "editor.snippetSuggestions": "none",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
    "gopls": {
        "usePlaceholders": true // add parameter placeholders when completing a function
    },
    "files.eol": "\n", // formatting only supports LF line endings    
}

go.mod:

module github.com/DazWilkin/basic-personality

go 1.12

require (
	github.com/gogo/protobuf v1.2.1
	github.com/google/certificate-transparency-go v1.0.21 // indirect
	github.com/google/trillian v1.2.1
	github.com/grpc-ecosystem/grpc-gateway v1.9.2 // indirect
	golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
	golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
	golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect
	golang.org/x/text v0.3.2 // indirect
	golang.org/x/tools v0.0.0-20190702152245-7e72c71c505f // indirect
	golang.org/x/tools/gopls v0.1.2-0.20190702152245-7e72c71c505f // indirect
	google.golang.org/grpc v1.21.1
)
GOPATH=$PWD/go
cd go/src/github.com/DazWilkin/basic-personality
GO111MODULE=on go get ./...
code --new-window .

What did you expect to see?

  • No import errors.
  • Ability to navigate to godocs
  • Code completion|help

What did you see instead?

image

And both the non-standard library imports error:

  • could not import github.com/google/trillian (no parsed files for package github.com/google/trillian)
  • could not import google.golang.org/grpc (no parsed files for package google.golang.org/grpc)

If, instead, I import old-school:

GO111MODULE=off go get ./...

It works.

I suspect I'm missing something either with this solution or with Go Modules (or both) but I'm expecting to be able to use the Go Modules (GO111MODULE=on) approach with this solution.

Is it because I'm still working under ${GOPATH} and have it set?

Perhaps related to #32762 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgegoplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions