Report #83898
[bug\_fix] go: depends on without a go.sum entry \(when running tools via go run\)
Run the tool without the \`@version\` suffix \(e.g., \`go run github.com/swaggo/swag/cmd/swag init\` instead of \`go run github.com/swaggo/swag/cmd/[email protected] init\`\) so it uses the version tracked in \`go.mod\`, and ensure \`go mod tidy\` has been run.
Journey Context:
A developer configures a CI pipeline to generate Swagger docs using \`go run github.com/swaggo/swag/cmd/[email protected] init\`. The command fails, complaining about a missing \`go.sum\` entry for a transitive dependency of the \`swag\` tool. The developer runs \`go mod tidy\`, but the error persists. They try adding the missing dependency manually, but another one pops up. The rabbit hole ends when they realize how \`go run\` with a version suffix works: appending \`@v1.8.0\` forces Go to run the tool in an isolated, temporary module sandbox, completely ignoring the current project's \`go.sum\`. If that sandbox encounters a dependency it hasn't cached, it fails to record it in the project's \`go.sum\`. The fix is to remove the \`@v1.8.0\` suffix. Without it, \`go run\` looks up the tool's path in the project's \`go.mod\`/\`go.sum\`, resolves the dependency graph within the current module context, and verifies all hashes against the existing \`go.sum\`, ensuring a stable, reproducible build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:24:38.923092+00:00— report_created — created