Skip to content

ci: add Go build/test/lint workflow#28

Merged
LeJamon merged 1 commit into
mainfrom
ci/add-go-workflow
Jun 29, 2026
Merged

ci: add Go build/test/lint workflow#28
LeJamon merged 1 commit into
mainfrom
ci/add-go-workflow

Conversation

@Sanka-D

@Sanka-D Sanka-D commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Context

The repo has no build/test/lint CI (only release and docs). PR #25 proposes one, but its lint job fails to even start — golangci-lint v1.62.0 is built with Go 1.23 and refuses to load a module targeting Go 1.24.4 (the Go language version (go1.23) ... is lower than the targeted Go version (1.24.4)). Its test jobs pass.

This adds a self-contained CI that is green today, fixing that root cause.

What's in it

.github/workflows/ci.yaml — two jobs:

  • test (ubuntu + macos matrix): go mod tidy check → go vetgo buildgo test -race -count=1 ./...
  • lint: golangci-lint v2.12.2 (built with Go ≥ 1.24, so it loads this module)

.golangci.yml — conservative starting config. Keeps the standard bug-finding linters (govet, ineffassign, staticcheck, unused). Two noisy items are relaxed with a TODO each, to keep this PR focused rather than a sweeping refactor:

  • errcheck disabled — ~32 unchecked-error sites (mostly Close()/os.Remove()/MarkFlagRequired)
  • QF1012 excluded — pervasive WriteString(fmt.Sprintf)fmt.Fprintf style nit

Real fixes so the chosen linters pass:

  • ST1005 capitalized error strings (builder, tester, coverage)
  • unused vars (embedded.setupError, init.validatorsTemplate + its //go:embed)
  • ineffectual assignment in the escrow --skip-build branch
  • a few WriteString(fmt.Sprintf)fmt.Fprintf (doc/gas generators)

go.mod/go.sum — ran go mod tidy so the tidy check passes (drops the unused btcutil direct dep; promotes fsnotify/image-spec to direct).

Verification

Locally, all green: go mod tidy (no diff), go vet ./..., go build ./..., go test -race ./..., golangci-lint run ./... (0 issues).

Relation to #25 / #27

The repo had no build/test/lint CI. Adds .github/workflows/ci.yaml with two
jobs, runnable green today:

- test (ubuntu + macos matrix): verifies go.mod is tidy, then go vet, go build,
  and go test -race ./...
- lint: golangci-lint v2 (built with Go >= 1.24, so it loads this go1.24
  module — the older v1.62 fails to load with a Go-version error)

A conservative .golangci.yml keeps the standard bug-finding linters (govet,
ineffassign, staticcheck, unused) and temporarily relaxes two noisy items to
keep this PR focused, each with a TODO to tighten in a follow-up:
- errcheck (disabled): ~32 unchecked-error sites
- QF1012 (excluded): pervasive WriteString(fmt.Sprintf) -> fmt.Fprintf nit

To make the chosen linters pass, fixes the real issues they flagged:
- ST1005 capitalized error strings (builder, tester, coverage)
- unused vars (embedded.setupError, init.validatorsTemplate + its embed)
- ineffectual assignment in escrow --skip-build branch
- a few WriteString(fmt.Sprintf) -> fmt.Fprintf in doc/gas generators

Also runs `go mod tidy` so the tidy check passes (drops the unused
btcutil direct dep; promotes fsnotify/image-spec to direct).
@LeJamon
LeJamon merged commit fa09b59 into main Jun 29, 2026
3 checks passed
@LeJamon
LeJamon deleted the ci/add-go-workflow branch June 29, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants