migrating to new workflows/makefiles - #191
Conversation
| go-checks: | ||
| uses: zondax/_workflows/.github/workflows/_checks-golang.yaml@main | ||
| with: | ||
| package_path: packages/prio-api |
|
Just saw this PR @jleni . Should we rebase and merge it? |
58c9d4b to
89e5c93
Compare
The reusable golang workflow calls go-build/go-mod-check/go-lint/go-test. Point those names at the existing targets and run CI on Go 1.25.
| uses: zondax/_workflows/.github/workflows/_checks-golang.yaml@main | ||
| with: | ||
| package_path: . | ||
| go_version: "1.25" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
To fix this, add an explicit permissions block in .github/workflows/ci-go.yml so the workflow does not rely on repository/org defaults. The least-privilege baseline for a CI workflow is typically contents: read. Since this workflow only triggers checks and calls a reusable workflow, setting workflow-level read-only permissions is the safest non-functional change unless specific write scopes are known to be required.
Best single fix here: insert a root-level permissions section after concurrency (before jobs) with:
contents: read
This keeps behavior functionally equivalent for normal read-only CI operations while satisfying CodeQL and documenting token scope.
| @@ -12,6 +12,9 @@ | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| go-checks: | ||
| uses: zondax/_workflows/.github/workflows/_checks-golang.yaml@main |
golangci-lint's install.sh finds the expected hash with `grep <tarball>` over the checksums file. Since v2.12.0 that file also lists `<tarball>.sbom.json`, so the grep returns two hashes, compares both against the one real hash, and always fails. Go lint checks have been broken on every branch since the v2.12.0 release. Download and unpack the release artifact directly instead, matching the checksum line by exact filename. The version is pinned and overridable via GOLANGCI_LINT_VERSION. Keeping the prebuilt binary matters: golangci-lint v2.13.2 requires Go 1.26 to build, while CI runs Go 1.25 with GOTOOLCHAIN=local, so `go install` is not an option here.
With go-lint running again, three occurrences of the "development" literal were flagged where the EnvironmentDevelopment constant already exists in the same package. Use the constant. Also wrap the deferred zap.ReplaceGlobals in TestInitLogger so staticcheck SA9010 no longer flags the discarded restore function. Behaviour is unchanged: the original logger is still restored on return.
Restoring the lint gate surfaced 53 pre-existing issues, all of them in test files and examples rather than shipped code. goconst fires on the short literals that table-driven tests and worked examples repeat by design, and the gosec web-hardening rules target request handlers in production, not the stub handlers tests stand up. Exclude both paths so the gate reports on code that ships. Production code is clean under the full linter set.
❌ Test Coverage Report
💡 How to improve coverage:
|
🔗 zboto Link