Home >Backend Development >Golang >How Do I Fix the 'go: go.mod File Not Found' Error in Go 1.16.2?
Troubleshooting Error "go: go.mod File Not Found" in Go Version 1.16.2
Upon updating to Go version 1.16.2, users may encounter an error when attempting to build Go programs. This error message indicates that a "go.mod" file is missing in the current directory or any parent directory. While setting environment variables as suggested in documentation may not resolve the issue, this article presents an alternative solution.
To resolve this error, follow these steps:
Enter the following command to disable module mode:
go env -w GO111MODULE=off
Note: This replaces the suggested command to set GO111MODULE to "auto."
By disabling module mode, the build process will no longer search for a "go.mod" file. As a result, the error should be eliminated.
The above is the detailed content of How Do I Fix the '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!