Skip to content

x/tools/gopls: make it clearer when diagnostics come from a non-default build context #65496

@pjweinb

Description

@pjweinb

Go version

go1.21.6

Output of go env in your module/workspace:

GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/pjw/Library/Caches/go-build"
GOENV="/Users/pjw/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/pjw/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/pjw/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/pjw/alt/telemetry/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xx/sy8s7hy16mnfcj8kyn5hwq5800052r/T/go-build2649792271=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

download x/telemetry at tip. Then in counter/counter.go and counter/counter_disabled.go remove the references to 386 in //go:build lines. (one in each file)

What did you see happen?

Type errors on c in counter/countertest/counter_test.go:

cannot use c (variable of type *"golang.org/x/telemetry/counter".Counter) as *"golang.org/x/telemetry/internal/counter".Counter value in argument to ReadCountercompilerIncompatibleAssign

What did you expect to see?

no errors. The tests in countertest/counter_test.go compile without errors and run.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues 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