Home >Backend Development >Golang >Why Am I Getting 'go: go.mod file not found...' Error in Go 1.16.2?

Why Am I Getting 'go: go.mod file not found...' Error in Go 1.16.2?

DDD
DDDOriginal
2024-12-05 17:24:10668browse

Why Am I Getting

"go: go.mod file not found in current directory or any parent directory; see 'go help modules'" Error

One developer updated to Go version 1.16.2, Linux/amd64 and received the error in the title. This error occurred when building a "Hello, World!" example.

The developer attempted to resolve the issue by setting GO111MODULE to on, and using a proxy, however, the issue persisted.

The solution to this problem is to set GO111MODULE to off, using this command:

go env -w GO111MODULE=off

The above is the detailed content of Why Am I Getting 'go: go.mod file not found...' Error in Go 1.16.2?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn