Update 2025-02-22 01:16 CT (07:16 UTC): I deleted the local instances of Hugo and Go that I manually downloaded and set up within my local website repo (the ones not installed by Homebrew). After doing that, the “Problem” thrown by VS Code from whatever error was happening with the Official Go Extension no longer exists. I had the Hugo binary installed in a bin folder, and the extracted go folder was placed at the top level of the repo. I’ve verified that the latest versions are what was downloaded from the Go site (v.1.24.0) and Hugo GitHub repo (v0.144.2). Each time I put the files back, the Problem comes back, and each time I remove them, it goes away.
Is there an issue doing this or doing it this way (having local Hugo/Go in your website repo that is outside of source control)? Is there a better way to save the Hugo binary and Go Folder in a website repo, so local testing can be done without the Homebrew global instances? I asked an LLM, and it seems to think it should be OK to simply exclude those folders from the Go Extension scanning to remove the problem… I just looked in a newly extracted Go download, and there is, indeed, a go.mod
file in the misc
folder and src
folder as well as some others, so maybe the scan is picking those up, too…
- Yes, VS Code auto-detects it as a “Go Module File” type (confirmed on Status Bar). The reason you don’t see different colors for
module
and the url is that the last screenshot I posted had the Go Language Support Extension turned off. If you look at the first svreenshot I posted, there are different colors, although it may be difficult to see that with my dark theme. Look closely, and you’ll see it.
- None.
- All Output of Go Extension, from VS Code start to opening
go.mod
:
2025-02-21 23:03:13.799 [info] Try to start language server - activation (enabled: true)
2025-02-21 23:03:14.027 [info] Running language server gopls(v0.17.1/go1.24.0)
However, the “gopls (server)” [Go’s language server] Output shows the following after freshly opening Vs Code and, then, opening the go.mod
file:
[Info - 11:47:13 PM] 2025/02/21 23:47:13 Created View (#1)
directory=/Users/bb-mbpro/Documents/_github/burkebrunson.github.io
view_type="GoMod"
root_dir="file:///Users/bb-mbpro/Documents/_github/burkebrunson.github.io"
go_version="go version go1.24.0 darwin/amd64"
build_flags=[]
env={GOOS:darwin GOARCH:amd64 GOCACHE:/Users/bb-mbpro/Library/Caches/go-build GOMODCACHE:/Users/bb-mbpro/go/pkg/mod GOPATH:/Users/bb-mbpro/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GOROOT:/usr/local/Cellar/go/1.24.0/libexec GoVersion:24 GoVersionOutput:go version go1.24.0 darwin/amd64
ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
env_overlay=[]
[Info - 11:47:14 PM] 2025/02/21 23:47:14 Created View (#2)
directory=/Users/bb-mbpro/Documents/_github/todo
view_type="AdHoc"
root_dir="file:///Users/bb-mbpro/Documents/_github/todo"
go_version="go version go1.24.0 darwin/amd64"
build_flags=[]
env={GOOS:darwin GOARCH:amd64 GOCACHE:/Users/bb-mbpro/Library/Caches/go-build GOMODCACHE:/Users/bb-mbpro/go/pkg/mod GOPATH:/Users/bb-mbpro/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GOROOT:/usr/local/Cellar/go/1.24.0/libexec GoVersion:24 GoVersionOutput:go version go1.24.0 darwin/amd64
ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
env_overlay=[]
[Info - 11:47:14 PM] 2025/02/21 23:47:14 go/packages.Load #2
view_id="2"
snapshot=0
directory=/Users/bb-mbpro/Documents/_github/todo
query=[./ builtin]
packages=2
duration=139.200001ms
[Info - 11:47:14 PM] 2025/02/21 23:47:14 Created View (#3)
directory=/Users/bb-mbpro/Documents/_github/burkebrunson
view_type="AdHoc"
root_dir="file:///Users/bb-mbpro/Documents/_github/burkebrunson"
go_version="go version go1.24.0 darwin/amd64"
build_flags=[]
env={GOOS:darwin GOARCH:amd64 GOCACHE:/Users/bb-mbpro/Library/Caches/go-build GOMODCACHE:/Users/bb-mbpro/go/pkg/mod GOPATH:/Users/bb-mbpro/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GOROOT:/usr/local/Cellar/go/1.24.0/libexec GoVersion:24 GoVersionOutput:go version go1.24.0 darwin/amd64
ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
env_overlay=[]
[Info - 11:47:14 PM] 2025/02/21 23:47:14 go/packages.Load #3
view_id="3"
snapshot=0
directory=/Users/bb-mbpro/Documents/_github/burkebrunson
query=[./ builtin]
packages=2
duration=86.202735ms
[Error - 11:47:16 PM] 2025/02/21 23:47:16 go/packages.Load #1: err: exit status 2: stderr: panic: LoadImport called with empty package path [recovered]
panic: LoadImport called with empty package path
goroutine 1 [running]:
cmd/go/internal/load.(*preload).flush(0xc00030f210)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:1128 +0x6a
panic({0xb036140?, 0xb11a540?})
/usr/local/Cellar/go/1.24.0/libexec/src/runtime/panic.go:787 +0x132
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0x0, {0x1243c855, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:717 +0x1530
cmd/go/internal/load.(*Package).load(0xc0002fa608, {0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2035 +0x24ce
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0xc00030f210, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:780 +0x52f
cmd/go/internal/load.PackagesAndErrors({0xb122f80?, 0xb55ed60?}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0000b23f0, 0x2, ...})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2920 +0xa33
cmd/go/internal/list.runList({0xb122f80, 0xb55ed60}, 0xc0000b08a0?, {0xc0000b23f0, 0x2, 0x2})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/list/list.go:618 +0xc6a
main.invoke(0xb52eb20, {0xc0000b2350, 0xc, 0xc})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:341 +0x845
main.main()
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:220 +0xe8b
view_id="1"
snapshot=0
directory=/Users/bb-mbpro/Documents/_github/burkebrunson.github.io
query=[/Users/bb-mbpro/Documents/_github/burkebrunson.github.io/... builtin]
packages=0
duration=2.173436726s
[Error - 11:47:16 PM] 2025/02/21 23:47:16 initial workspace load failed: packages.Load error: err: exit status 2: stderr: panic: LoadImport called with empty package path [recovered]
panic: LoadImport called with empty package path
goroutine 1 [running]:
cmd/go/internal/load.(*preload).flush(0xc00030f210)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:1128 +0x6a
panic({0xb036140?, 0xb11a540?})
/usr/local/Cellar/go/1.24.0/libexec/src/runtime/panic.go:787 +0x132
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0x0, {0x1243c855, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:717 +0x1530
cmd/go/internal/load.(*Package).load(0xc0002fa608, {0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2035 +0x24ce
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0xc00030f210, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:780 +0x52f
cmd/go/internal/load.PackagesAndErrors({0xb122f80?, 0xb55ed60?}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0000b23f0, 0x2, ...})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2920 +0xa33
cmd/go/internal/list.runList({0xb122f80, 0xb55ed60}, 0xc0000b08a0?, {0xc0000b23f0, 0x2, 0x2})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/list/list.go:618 +0xc6a
main.invoke(0xb52eb20, {0xc0000b2350, 0xc, 0xc})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:341 +0x845
main.main()
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:220 +0xe8b
[Info - 11:47:43 PM] 2025/02/21 23:47:43 background imports cache refresh starting
[Info - 11:47:44 PM] 2025/02/21 23:47:44 background imports cache refresh starting
[Info - 11:47:44 PM] 2025/02/21 23:47:44 background refresh finished after 28.990102ms
[Info - 11:47:44 PM] 2025/02/21 23:47:44 background refresh finished after 415.121878ms
[Info - 11:47:44 PM] 2025/02/21 23:47:44 background imports cache refresh starting
[Info - 11:47:44 PM] 2025/02/21 23:47:44 background refresh finished after 15.658718ms
[Error - 11:47:51 PM] 2025/02/21 23:47:51 errors loading workspace: packages.Load error: err: exit status 2: stderr: panic: LoadImport called with empty package path [recovered]
panic: LoadImport called with empty package path
goroutine 1 [running]:
cmd/go/internal/load.(*preload).flush(0xc00030f210)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:1128 +0x6a
panic({0xb036140?, 0xb11a540?})
/usr/local/Cellar/go/1.24.0/libexec/src/runtime/panic.go:787 +0x132
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0x0, {0x1243c855, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:717 +0x1530
cmd/go/internal/load.(*Package).load(0xc0002fa608, {0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2035 +0x24ce
cmd/go/internal/load.loadImport({0xb122f80, 0xb55ed60}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, 0xc00030f210, {0xc0004de180, ...}, ...)
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:780 +0x52f
cmd/go/internal/load.PackagesAndErrors({0xb122f80?, 0xb55ed60?}, {0x0, 0x1, 0x0, 0x1, 0x1, 0x0}, {0xc0000b23f0, 0x2, ...})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/load/pkg.go:2920 +0xa33
cmd/go/internal/list.runList({0xb122f80, 0xb55ed60}, 0xc0000b08a0?, {0xc0000b23f0, 0x2, 0x2})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/internal/list/list.go:618 +0xc6a
main.invoke(0xb52eb20, {0xc0000b2350, 0xc, 0xc})
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:341 +0x845
main.main()
/usr/local/Cellar/go/1.24.0/libexec/src/cmd/go/main.go:220 +0xe8b
view_id="1"
snapshot=1
directory=/Users/bb-mbpro/Documents/_github/burkebrunson.github.io
- I searched my website repo. There is no go.work file. I am not doing anything other than maintaining my personal Hugo website an incrementally updating Hugo and its Go dependency as new releases come forth.
- I am not certain if it can reach github.com (?). Everything about the template I use is operating as it should, and the website builds locally and when deployed in production. That’s as far as I get with that. When I run the command, everything runs fine. Yes, the same binary is used.
- I use homebrew to install Hugo and Go globally, and I also have regularly placed a copy of the latest Hugo and Go in my website repo (outside of source control) in order to do initial testing for updates using a new branch each time. I am able to change PATH in a VS Code terminal session in order to be able to use both instances of Hugo and Go, as needed. Running
go version
on both instances shows a return of go version go1.24.0 darwin/amd64
.
I’ve tried disabling individual Go and Hugo extensions. None of them removed the error except disabling/uninstalling the Go Official Extension. However, on my “Default” profile, if I uninstall it and reinstall it, the “Problem” output persists. I did not see any Go-Extension-specific things except a tools auto updater in the VS Code settings.json
.
I created a new “Test” VS Code profile, and ran which go
to get a return of /usr/local/bin/go
(where Homebrew installs it) and go version
to get a return of go version go1.24.0 darwin/amd64
and installed only the Go Rich Language Support Extension and the Vs Code “Problem” came back up again, without any other VS Code extensions installed.