Go version

go version go1.22.3 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users/wayneforrest/go/bin'
GOCACHE='/Users/wayneforrest/Library/Caches/go-build'
GOENV='/Users/wayneforrest/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/wayneforrest/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/wayneforrest/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/opt/go/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/wayneforrest/Documents/Projects/nextup/nextup-lib/go.mod'
GOWORK='/Users/wayneforrest/Documents/Projects/nextup/nextup-lib/go.work'
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 -ffile-prefix-map=/var/folders/40/h2gz12596h37pwhss5_bsqdh0000gn/T/go-build392454702=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Edit a "windows" file (platform specific) .. main_windows.go on MacOS Arm64 / M1.

I have two files, main_darwin.go and main_windows.go that serve two purposes, the Darwin one is for testing the code on MacOS, while the windows one is what will ultimately ship and be packaged.

When editing the main_windows.go file I am unable to navigate to symbol / function using VsCode.

What did you see happen?

When navigating to a symbol by pressing F12, I get the message No definition found for FatalF.

I notice this stack trace: ERR no package metadata for file file:///Users/wayneforrest/Documents/Projects/nextup/nextup-lib/main_windows.go: Error: no package metadata for file file:///Users/wayneforrest/Documents/Projects/nextup/nextup-lib/main_windows.go at handleResponse (/Users/wayneforrest/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8606:40) at handleMessage (/Users/wayneforrest/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8416:11) at processMessageQueue (/Users/wayneforrest/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8431:13) at Immediate.<anonymous> (/Users/wayneforrest/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8407:11) at process.processImmediate (node:internal/timers:476:21)

Note the stdlog: import ( "fmt" stdLog "log" "runtime/debug" "sync" "time"

Screenshot 2024-05-25 at 2 12 16 PM

What did you expect to see?

When I navigate to the symbol/function from the main_darwin.go file, it works, but not when I navigate from main_windows.go file.

Comment From: findleyr

Hi, which gopls version are you using? This should work from gopls@v0.15.0+.

Comment From: findleyr

In a dupe of this issue (golang/vscode-go#3421), we learned that this is related to cgo files, and the fact that cross platform development implies CGO_ENABLED=0.

Therefore, this is a dupe of #65758.