profile
viewpoint

Ask questionsx/tools/gopls: could not import fmt (no package for import fmt)

Hi everyone, I just learned golang, this problem has troubled me for a long time, can you help me solve it? thank you very much

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/alex/Library/Caches/go-build"
GOENV="/Users/alex/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/alex/workspace/learngo"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
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=/var/folders/t2/g3snv2xs0ll_114bqxhz2t6h0000gn/T/go-build374694917=/tmp/go-build -gno-record-gcc-switches -fno-common"

image

gopls -rpc.trace -v check /Users/alex/workspace/test.go

2020/08/14 00:33:25 Info:2020/08/14 00:33:25 Build info
----------
golang.org/x/tools/gopls 0.4.4
    golang.org/x/tools/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
    golang.org/x/sync@v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
    golang.org/x/tools@v0.0.0-20200729181040-64cdafbe085c h1:jLQLIAedRoS9I2Py7l/ZAGGzUxLFsdg42JXEpS/a+ow=
    golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    honnef.co/go/tools@v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
    mvdan.cc/gofumpt@v0.0.0-20200709182408-4fd085cb6d5f h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

Go info
-------
go version go1.14.4 darwin/amd64


2020/08/14 00:33:25 Info:2020/08/14 00:33:25 go env for /Users/alex/workspace/learngo/bin
(root /Users/alex/workspace/learngo/bin)
(valid build configuration = false)
(build flags: [])
GOINSECURE=
GOMOD=
GOPATH=/Users/alex/workspace/learngo
GOPRIVATE=
GOROOT=/usr/local/go
GO111MODULE=
GOCACHE=/Users/alex/Library/Caches/go-build
GOFLAGS=
GOMODCACHE=
GONOPROXY=
GOSUMDB=sum.golang.org
GOPROXY=https://goproxy.cn,direct
GONOSUMDB=

2020/08/14 00:33:25 Info:2020/08/14 00:33:25 go/packages.Load
	snapshot=0
	directory=/Users/alex/workspace/learngo/bin
	query=[./ builtin]
	packages=2
2020/08/14 00:33:25 Info:2020/08/14 00:33:25 go/packages.Load
	snapshot=0
	directory=/Users/alex/workspace/learngo/bin
	query=[./]
	packages=1
golang/go

Answer questions andybons

Hi there,

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

Please ask the question on one of the above forums.

(Quoted from https://golang.org/wiki/Questions)

useful!
source:https://uonfu.com/
Github User Rank List