feat: add doctor mode to detect configuration issues #38

Open
opened 2026-05-06 00:00:04 +02:00 by heiko · 0 comments
Owner

Summary

Add a gogogo doctor subcommand that inspects the project configuration and reports common issues before they cause cryptic failures at release time.

Checks to implement

1. Module path mismatch (go.mod vs .gogogo.conf)

Compare the module directive in go.mod with the module: field in .gogogo.conf. Report an error if they differ.

Example of what this catches:

$ gogogo doctor
✗ module path mismatch:
    go.mod:       go.schlittermann.de/heiko/hello
    .gogogo.conf: go.schlittermann.de/heiko/hello/v2
  The module proxy will serve the module under the go.mod path.
  Fix: update .gogogo.conf to match go.mod, or update go.mod if /v2 is intended.

This mismatch causes verification to fail with a hash mismatch because the proxy zips the module under the go.mod path, but gogogo queries it under the config path.

Future checks (ideas)

  • Token validity (can we authenticate with the API?)
  • Repo accessibility (does the configured repo exist?)
  • Target validity (are configured OS/arch pairs supported?)
  • Tag consistency (does HEAD have a semver tag when expected?)
  • Redirect detection (does the API URL redirect, suggesting restrict30x config?)
  • GOPRIVATE/GIT_CONFIG consistency for private repos

Expected output style

$ gogogo doctor
✓ module path matches go.mod
✓ repo API reachable (https://forgejo.schlittermann.de/api/v1)
✓ token valid (user: heiko)
✗ API URL redirects to forgejo.schlittermann.de — consider updating apiurl
## Summary Add a `gogogo doctor` subcommand that inspects the project configuration and reports common issues before they cause cryptic failures at release time. ## Checks to implement ### 1. Module path mismatch (go.mod vs .gogogo.conf) Compare the `module` directive in `go.mod` with the `module:` field in `.gogogo.conf`. Report an error if they differ. **Example of what this catches:** ``` $ gogogo doctor ✗ module path mismatch: go.mod: go.schlittermann.de/heiko/hello .gogogo.conf: go.schlittermann.de/heiko/hello/v2 The module proxy will serve the module under the go.mod path. Fix: update .gogogo.conf to match go.mod, or update go.mod if /v2 is intended. ``` This mismatch causes verification to fail with a hash mismatch because the proxy zips the module under the go.mod path, but gogogo queries it under the config path. ### Future checks (ideas) - Token validity (can we authenticate with the API?) - Repo accessibility (does the configured repo exist?) - Target validity (are configured OS/arch pairs supported?) - Tag consistency (does HEAD have a semver tag when expected?) - Redirect detection (does the API URL redirect, suggesting `restrict30x` config?) - GOPRIVATE/GIT_CONFIG consistency for private repos ## Expected output style ``` $ gogogo doctor ✓ module path matches go.mod ✓ repo API reachable (https://forgejo.schlittermann.de/api/v1) ✓ token valid (user: heiko) ✗ API URL redirects to forgejo.schlittermann.de — consider updating apiurl ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
heiko/gogogo#38
No description provided.