I have tired quite a few fixes, but still unable to get this to work. I do not have a go.mod file set.
Current GO ENV
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\matt\AppData\Local\go-build
set GOENV=C:\Users\matt\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\matt\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\matt\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.23.1
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\matt\AppData\Roaming\go\telemetry
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\MATT~1\AppData\Local\Temp\go-build4268344471=/tmp/go-build -gno-record-gcc-switches
Newbie? Then use go.mod!
Execute the following commands:
cd (your project path)
go mod init (your project domain name, such as github.com/xxx/yyyy, this domain name is generally the accessible path of the project, if your project wants to be referenced; of course, you can fill in something casually)
go mod tidy
It’s not the mod’s fault, it’s your code’s fault.
Check your code for package cycles.
If you don’t know what a package cycle is, then what you should do is consult a book.
It looks like you initialized your module with the name of the module you want to import. Since you initialized the module with the module you are trying to import, the error is saying “I can’t import myself” more or less. Try go mod init example.com/matt/testing.
Here’s an example importing that module on the playground that works fine: