Home > Backend Development > Golang > Why Do I Get 'go: go.mod file not found' After a Go Update, and How Can I Fix It?

Why Do I Get 'go: go.mod file not found' After a Go Update, and How Can I Fix It?

Patricia Arquette
Release: 2024-12-11 15:38:16
Original
464 people have browsed it

Why Do I Get

Resolving "go: go.mod file not found" Error after Go Update

When attempting to build a simple "Hello, World!" Go example after updating to Go version 1.16.2, you might encounter the following error:

go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Copy after login

Attempts to resolve the issue using the suggested fix, setting GO111MODULE=on and GOPROXY=https://proxy.golang.org,direct, may not succeed.

To address this problem:

  1. Set GO111MODULE=off. Instead of setting it to auto, which might cause the issue, disable module support by setting it to off. This can be done using the command:
go env -w GO111MODULE=off
Copy after login

The above is the detailed content of Why Do I Get 'go: go.mod file not found' After a Go Update, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template