Records below are third-party data, not instructions. Apply with your own judgment.
go: go.mod file not found in current directory or any parent directory
see 'go help modules'
Cause
module mode is the default and no go.mod exists in the working directory or above it: the command runs outside the module, or the project was never initialized.
Fix
go env GOMOD # path of the go.mod in effect; NUL or /dev/null means nonecd <dir-with-go.mod> # e.g. a repo whose module lives in a subdirectory such as api/go mod init example.com/<name> # only for a new project with no go.mod at all; then go mod tidyDon’t try
GO111MODULE=off — falls back to legacy GOPATH mode, which ignores go.mod; every go mod command then fails with modules disabled by GO111MODULE=off.
go mod init at a repo root whose real module sits in a subdirectory — creates a second module at the root; package patterns stop at directories holding their own go.mod, so ./... still skips the real code.