I was trying to install gopls in vscode, I tried this by clicking icons from vscode, but it not work, then I tried in CLI and it was still not working; here is what I got:
$ go install -v golang.org/x/tools/gopls@latest
# golang.org/x/tools/gopls
/usr/local/go/pkg/tool/darwin_arm64/link: running x86_64-apple-darwin13.4.0-clang failed: exit status 1
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd' for architecture arm64
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
Here are some information:
$ go version
go version go1.21.6 darwin/arm64
$ gopls -v version
bash: gopls: command not found
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/xxx/Library/Caches/go-build'
GOENV='/Users/xxx/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/xxx/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/xxx/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
AR='x86_64-apple-darwin13.4.0-ar'
CC='x86_64-apple-darwin13.4.0-clang'
CXX='x86_64-apple-darwin13.4.0-clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -ffile-prefix-map=/var/folders/yh/d_jgns49545bkkpm4rst2c_80000gn/T/go-build3182514498=/tmp/go-build -gno-record-gcc-switches -fno-common'
This is what I got by clicking the install button in vscode:
Tools environment: GOPATH=/Users/xxx/go
Installing 1 tool at /Users/xxx/go/bin
gopls
Installing golang.org/x/tools/gopls@latest FAILED
{
"code": 1,
"killed": false,
"signal": null,
"cmd": "/usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest",
"stdout": "",
"stderr": "# golang.org/x/tools/gopls\n/usr/local/go/pkg/tool/darwin_arm64/link: running x86_64-apple-darwin13.4.0-clang failed: exit status 1\nld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd' for architecture arm64\nclang-12: error: linker command failed with exit code 1 (use -v to see invocation)\n\n"
}
1 tools failed to install.
gopls: failed to install gopls(golang.org/x/tools/gopls@latest): Error: Command failed: /usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest
# golang.org/x/tools/gopls
/usr/local/go/pkg/tool/darwin_arm64/link: running x86_64-apple-darwin13.4.0-clang failed: exit status 1
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd' for architecture arm64
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
Trying to install gopls