diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fe3436e..70b982e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,7 +10,7 @@ jobs: name: Test strategy: matrix: - go-version: [1.21.x, 1.22.x] + go-version: [1.22.x, 1.23.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 970f609..1723af0 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -15,8 +15,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '~1.21' - check-latest: true + go-version-file: 'go.mod' - uses: actions/cache@v4 with: path: | @@ -45,10 +44,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '~1.21' - check-latest: true + go-version-file: 'go.mod' - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.55.2 - args: -v \ No newline at end of file + version: v1.60.3 + args: -v diff --git a/.golangci.yml b/.golangci.yml index 102372c..5629f4d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,19 +1,17 @@ run: timeout: 2m - go: '1.21' linters: enable: - - deadcode - errcheck - gosimple - govet - ineffassign - staticcheck - - structcheck - typecheck - unused - - varcheck + - unparam + - unconvert - bodyclose - decorder - makezero @@ -25,6 +23,8 @@ linters: - unparam - misspell - unconvert + - depguard + - unused issues: exclude-use-default: true @@ -32,3 +32,13 @@ issues: max-issues-per-linter: 50 max-same-issues: 10 new: false + + +linters-settings: + depguard: + rules: + main: + files: + - .* + allow: + - .* \ No newline at end of file diff --git a/Makefile b/Makefile index 6b3ecdb..f1df03a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,12 @@ .PHONY: default default: help +GO=go +GOLANGCI=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 +gofumpt=mvdan.cc/gofumpt@latest +govulncheck=golang.org/x/vuln/cmd/govulncheck@latest +actionlint=github.com/rhysd/actionlint/cmd/actionlint@latest + .PHONY: test test: go test -v ./... @@ -9,18 +15,17 @@ test: help: ## Show the available commands @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: install-tools -install-tools: - go install mvdan.cc/gofumpt@latest - go install golang.org/x/vuln/cmd/govulncheck@latest - bash ./scripts/install-golangci-lint.sh v1.55.2 - .PHONY: lint -lint: fmt - golangci-lint run -v --timeout 5m +lint: fmt ## Run linters on all go files + $(GO) run $(GOLANGCI) run -v + $(GO) run $(actionlint) + @$(MAKE) sec .PHONY: fmt -fmt: install-tools - govulncheck ./... - gofumpt -l -w -extra . +fmt: ## Formats all go files + $(GO) run $(gofumpt) -l -w -extra . + +.PHONY: sec +sec: ## Run security checks + $(GO) run $(govulncheck) ./... diff --git a/go.mod b/go.mod index 7300bc8..aa1a3ac 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,9 @@ module github.com/rudderlabs/compose-test -go 1.21 - -toolchain go1.21.3 +go 1.23.1 require ( - github.com/jackc/pgx/v5 v5.7.0 + github.com/jackc/pgx/v5 v5.7.1 github.com/stretchr/testify v1.9.0 ) @@ -16,7 +14,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - golang.org/x/crypto v0.20.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/text v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index b401f0f..10a5156 100644 --- a/go.sum +++ b/go.sum @@ -6,10 +6,10 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.7.0 h1:FG6VLIdzvAPhnYqP14sQ2xhFLkiUQHCs6ySqO91kF4g= -github.com/jackc/pgx/v5 v5.7.0/go.mod h1:awP1KNnjylvpxHuHP63gzjhnGkI1iw+PMoIwvoleN/8= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs= +github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -23,12 +23,12 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= -golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/scripts/install-golangci-lint.sh b/scripts/install-golangci-lint.sh deleted file mode 100755 index c5bc445..0000000 --- a/scripts/install-golangci-lint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -VERSION=$1 -[ -z "${VERSION}" ] && VERSION="v1.55.2" -GOPATH=$(go env GOPATH) -[ -f "${GOPATH}/bin/golangci-lint-${VERSION}" ] && echo "golangci-lint ${VERSION} is already installed" || \ -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh | sh -s -- -b "${GOPATH}"/bin ${VERSION} && \ -cp "${GOPATH}"/bin/golangci-lint "${GOPATH}"/bin/golangci-lint-${VERSION}