ci: add Go build/test/lint workflow#28
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The repo has no build/test/lint CI (only
releaseand docs). PR #25 proposes one, but itslintjob 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)). Itstestjobs 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 tidycheck →go vet→go build→go 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:errcheckdisabled — ~32 unchecked-error sites (mostlyClose()/os.Remove()/MarkFlagRequired)QF1012excluded — pervasiveWriteString(fmt.Sprintf)→fmt.Fprintfstyle nitReal fixes so the chosen linters pass:
ST1005capitalized error strings (builder, tester, coverage)embedded.setupError,init.validatorsTemplate+ its//go:embed)--skip-buildbranchWriteString(fmt.Sprintf)→fmt.Fprintf(doc/gas generators)go.mod/go.sum— rango mod tidyso the tidy check passes (drops the unusedbtcutildirect dep; promotesfsnotify/image-specto 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
ci.yaml/.golangci.yml); this one is scoped to just a working CI and is green. Either can merge; the other rebases.