"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Why does "go build" report an error "module...is found but does not include packages"?

Why does "go build" report an error "module...is found but does not include packages"?

Posted on 2025-04-29
Browse:362

Why Does

"go module @latest found but does not contain package" Issue

When using Go modules for the first time, you may encounter the error message:

module github.com/mkideal/cli@latest found (v0.2.2), but does not contain package github.com/mkideal/cli
module github.com/mkideal/cli@latest found (v0.2.2), but does not contain package github.com/mkideal/cli/ext

This error occurs during go build and is not encountered during go get, indicating that the issue may not lie with the proxy settings or the Go module/package.

In this case, the root cause of the problem is a cached copy of the module metadata in the Go module cache. To resolve this, run the following command:

go clean -modcache

This command clears the Go module cache, allowing Go to download the latest metadata for the module and its dependencies. This ensures that the package versions and their contents are accurately reflected during the go build process.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3