I have a directory structure posted below. The VScode doesn’t complain before I add gojenkins folder under 2024 and run go mod init xxxx. However, VScode complain Error loading workspace: gopls was not able to find modules in your workspace.. So I try to add a go.work file to solve this problem but still, it doesn’t work.
.
|-- 2024
| |-- 1-10
| | |-- 1
| | | `-- main.go
| | |-- 2
| | | `-- main.go
| | |-- 3
| | | `-- main.go
| | |-- 4-buffered-chan
| | | `-- main.go
| | `-- 5-buffered-chan
| | `-- main.go
| |-- 1-11
| | |-- 1
| | | `-- main.go
| | |-- 10-library-mangement-started
| | |-- 2
| | | `-- main.go
| | |-- 3
| | | `-- main.go
| | |-- 4
| | | `-- main.go
| | |-- 5
| | | `-- main.go
| | |-- 6-lab
| | | `-- main.go
| | |-- 7-lab
| | | `-- main.go
| | |-- 8-lab
| | | `-- main.go
| | `-- 9-timeout
| | `-- main.go
| |-- 1-12
| | |-- 1
| | | `-- main.go
| | `-- 2
| | `-- main.go
| |-- 1-4
| | |-- 1
| | | `-- main.go
| | |-- 2
| | | `-- main.go
| | `-- 3
| | `-- main.go
| |-- 1-5
| | |-- 1
| | | `-- main.go
| | |-- 2
| | | `-- main.go
| | |-- 3
| | | `-- main.go
| | |-- 4
| | | `-- main.go
| | `-- 5
| | `-- main.go
| |-- 1-8
| | |-- 1
| | | `-- main.go
| | |-- 2
| | | `-- main.go
| | |-- 3
| | | `-- main.go
| | |-- 4
| | | `-- main.go
| | `-- 5
| | `-- main.go
| |-- 1-9
| | |-- 1
| | | `-- main.go
| | |-- 2
| | | `-- main.go
| | `-- 3
| | `-- main.go
| |-- go.mod
| `-- go.sum
|-- go.work
`-- gojenkins
|-- go.mod
`-- main.go
go 1.21.5
use (
./2024
./gojenkins
)
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\fanlo\AppData\Local\go-build
set GOENV=C:\Users\fanlo\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\fanlo\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\fanlo\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\fanlo\AppData\Local\Temp\go-build4277031076=/tmp/go-build -gno-record-gcc-switches