From ce6e359035b0ed3056a8ed7f7b6f1b8c973e9a09 Mon Sep 17 00:00:00 2001 From: Oleg Balunenko Date: Thu, 5 Sep 2024 23:20:52 +0400 Subject: [PATCH] feat: Bump go to 1.23 (#321) * feat: Bump go to 1.23 * fix: golangci config * fix: linter warning --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/go.yml | 8 ++++---- .github/workflows/release.yml | 8 ++++---- .golangci.pipe.yml | 10 +++++----- .goreleaser.yml | 4 +++- Makefile | 3 +-- build/docker/go-tools/Dockerfile | 2 +- deployments/docker-compose/go-tools-docker-compose.yml | 2 -- go.mod | 2 +- internal/puzzles/result.go | 8 +++----- scripts/linting/golangci-pipeline.sh | 2 +- 11 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d9687309..6561b5b1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,7 @@ jobs: # Learn more about CodeQL language support at https://git.io/codeql-language-support language: [ 'go' ] os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bf1da0d7..2c7408c6 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -41,7 +41,7 @@ jobs: max-parallel: 3 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Build steps: @@ -98,7 +98,7 @@ jobs: max-parallel: 2 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Run Tests steps: @@ -145,7 +145,7 @@ jobs: max-parallel: 2 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Run linters steps: @@ -202,7 +202,7 @@ jobs: max-parallel: 1 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Quality reports steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c76c293f..1d5fba76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: max-parallel: 2 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Build steps: @@ -60,7 +60,7 @@ jobs: max-parallel: 2 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Regression tests steps: @@ -109,7 +109,7 @@ jobs: max-parallel: 1 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Lint steps: @@ -162,7 +162,7 @@ jobs: max-parallel: 1 matrix: os: [ 'ubuntu-22.04' ] - go-version: [1.21] + go-version: [1.23] runs-on: ${{ matrix.os }} name: Release steps: diff --git a/.golangci.pipe.yml b/.golangci.pipe.yml index b368f910..3c820d85 100644 --- a/.golangci.pipe.yml +++ b/.golangci.pipe.yml @@ -28,6 +28,10 @@ linters-settings: arguments: [ [ "call-chain", "loop", "method-call", "recover", "return" ] ] issues: + exclude-files: + - \.pb\.go$ + exclude-dirs: + - vendor exclude-use-default: false exclude: # for "public interface + private struct implementation" cases only! @@ -97,16 +101,12 @@ issues: run: issues-exit-code: 1 tests: true - skip-dirs: - - vendor/ - skip-files: - - \.pb\.go$ # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions # default is "colored-line-number" - format: github-actions + formats: colored-line-number # print lines of code with issue, default is true print-issued-lines: true diff --git a/.goreleaser.yml b/.goreleaser.yml index 20736d77..d84a3b71 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,5 @@ +version: 2 + release: github: owner: obalunenko @@ -79,7 +81,7 @@ checksum: name_template: "{{ .ProjectName }}-{{ .Version }}-checksums.txt" snapshot: - name_template: SNAPSHOT-{{ .Commit }} + version_template: SNAPSHOT-{{ .Commit }} changelog: sort: asc diff --git a/Makefile b/Makefile index e8b647b5..924a0ccc 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ SHELL := env VERSION=$(VERSION) $(SHELL) VERSION ?= $(shell git describe --tags $(git rev-list --tags --max-count=1)) -GOVERSION:=1.21 +GOVERSION:=1.23 APP_NAME?=aoc-cli SHELL := env APP_NAME=$(APP_NAME) $(SHELL) -GOTOOLS_IMAGE_TAG?=v0.12.1 SHELL := env GOTOOLS_IMAGE_TAG=$(GOTOOLS_IMAGE_TAG) $(SHELL) COMPOSE_TOOLS_FILE=deployments/docker-compose/go-tools-docker-compose.yml diff --git a/build/docker/go-tools/Dockerfile b/build/docker/go-tools/Dockerfile index 896b9b80..d7c567d8 100644 --- a/build/docker/go-tools/Dockerfile +++ b/build/docker/go-tools/Dockerfile @@ -1,3 +1,3 @@ -FROM ghcr.io/obalunenko/go-tools:v1.4.4 AS builder +FROM ghcr.io/obalunenko/go-tools:v1.5.1 AS builder CMD ["/bin/sh", "-c", ""] diff --git a/deployments/docker-compose/go-tools-docker-compose.yml b/deployments/docker-compose/go-tools-docker-compose.yml index eb5e4d3d..76fd61ec 100755 --- a/deployments/docker-compose/go-tools-docker-compose.yml +++ b/deployments/docker-compose/go-tools-docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - services: tools: build: diff --git a/go.mod b/go.mod index 88bc81dc..28cef43a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/obalunenko/advent-of-code -go 1.21 +go 1.23 toolchain go1.22.5 require ( diff --git a/internal/puzzles/result.go b/internal/puzzles/result.go index 8cb4143d..da457de3 100644 --- a/internal/puzzles/result.go +++ b/internal/puzzles/result.go @@ -96,15 +96,13 @@ func printTable(w io.Writer, table [][]string) error { case 0: _, err = fmt.Fprintf(w, "\n") case 1: - _, err = fmt.Fprintf(writer, "\t"+strings.Join(line, "\t")+"\t\n") + _, err = fmt.Fprintf(writer, "\t%s", strings.Join(line, "\t")+"\t\n") default: - _, err = fmt.Fprintf(writer, "\t "+strings.Join(line, "\t")+"\t\n") + _, err = fmt.Fprintf(writer, "\t %s", strings.Join(line, "\t")+"\t\n") } if err != nil { - if err != nil { - return fmt.Errorf("fprintln: %w", err) - } + return fmt.Errorf("fprintln: %w", err) } } diff --git a/scripts/linting/golangci-pipeline.sh b/scripts/linting/golangci-pipeline.sh index 5404b62b..b0d10cf1 100755 --- a/scripts/linting/golangci-pipeline.sh +++ b/scripts/linting/golangci-pipeline.sh @@ -15,7 +15,7 @@ checkInstalled golangci-lint echo "Linting..." -golangci-lint run --out-format=github-actions --no-config --disable-all -E govet +golangci-lint run --out-format=colored-line-number --no-config --disable-all -E govet golangci-lint run --config .golangci.pipe.yml echo "${SCRIPT_NAME} done."