Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.13.12 darwin/amd64
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="auto" GOARCH="amd64" GOBIN="" GOCACHE="/Users/jason/Library/Caches/go-build" GOENV="/Users/jason/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/jason/Desktop/projects/GOPATH" GOPRIVATE="" GOPROXY="" GOROOT="/usr/local/opt/[email protected]/libexec" GOSUMDB="off" GOTMPDIR="" GOTOOLDIR="/usr/local/opt/[email protected]/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/jason/Desktop/projects/xxx/go.mod" 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/z5/6kmls3wj45v9f0c456grhdnc0000gn/T/go-build577824137=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
My go project dir is /my-project. In this dir, there is a webui sub dir, witch is initialized with npm. When I open VSCode to do changes on /my-project, gopls process keeps running at 700% CPU utility.
I used go pprof to generate a flame graph. There were lots of CPU running at filepath.EvalSymlinks and os.Stat. I guess it has something to do with node_modules. I moved webui dir out of /my-project, then CPU utility dropped to normal.
I hope gopls could support excluding files like vscode does. And I see a issue with the same request. #37697
#37697
The profiling file is attached.
pprof.samples.cpu.002.pb.gz