From b851419f092b799cf2aea453558b6aade2a27a5f Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 30 Aug 2024 10:48:44 -0400 Subject: [PATCH] build: Test against Go 1.23 --- .github/workflows/go.yml | 12 ++++++------ .golangci.yml | 29 +++++++++++++++++++++++++++++ main.go | 4 +++- 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2087c5d..120f479 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -9,20 +9,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [1.18, 1.19] + go: ["1.22", "1.23"] steps: + - name: Check out source + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Go - uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a #v3.2.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: ${{ matrix.go }} - - name: Check out source - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2 - name: Install Linters - run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.48.0" + run: "go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1" - name: Build run: go build ./... - name: Lint run: | - golangci-lint run --disable-all --deadline=10m --enable=gofmt --enable=govet --enable=gosimple --enable=unconvert --enable=ineffassign + golangci-lint run - name: Test run: go test -v ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..0d95496 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,29 @@ +run: + deadline: 10m + +linters: + disable-all: true + enable: + - asciicheck + - bidichk + - bodyclose + - dupword + - durationcheck + - errchkjson + - errorlint + - exportloopref + - gofmt + - goimports + - gosimple + - govet + - grouper + - ineffassign + - misspell + - nilerr + - nosprintfhostport + - reassign + - rowserrcheck + - tparallel + - typecheck + - unconvert + - unused diff --git a/main.go b/main.go index a842ac7..816e333 100644 --- a/main.go +++ b/main.go @@ -628,7 +628,9 @@ func (d *dcrinstallManifest) fakedist(dist *dist) { log.Fatal(err) } hash.Reset() - io.Copy(hash, fi) + if _, err = io.Copy(hash, fi); err != nil { + log.Fatalf("copy failed: %v", err) + } fi.Close() sum := hash.Sum(nil) _, err = fmt.Fprintf(w, "%x %s\n", sum, u)