diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64dfe6e..aeaac70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,10 +10,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Set up go 1.20 + - name: Set up go 1.21 uses: actions/setup-go@v3 with: - go-version: "1.20" + go-version: "1.21" id: go - name: Checkout @@ -28,7 +28,7 @@ jobs: - name: Run linters uses: golangci/golangci-lint-action@v3 with: - version: v1.53.3 + version: v1.56.2 env: TZ: "Etc/UTC" @@ -98,12 +98,12 @@ jobs: needs: build runs-on: ubuntu-latest env: - goreleaser_version: "v1.20.0" + goreleaser_version: "v1.24.0" steps: - - name: Set up go 1.20 + - name: Set up go 1.21 uses: actions/setup-go@v3 with: - go-version: "1.20" + go-version: "1.21" id: go - name: Checkout diff --git a/.golangci.yml b/.golangci.yml index 2f1353f..6dac81b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,6 +19,11 @@ linters-settings: locale: US lll: line-length: 140 + gocritic: + enabled-tags: + - performance + - style + - experimental linters: enable: @@ -49,6 +54,7 @@ issues: exclude-rules: - path: _test\.go linters: + - gocritic - gosec - text: "at least one file in a package should have a package comment" linters: diff --git a/Dockerfile b/Dockerfile index 79272f6..c4c5ade 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG REPO_BUILD_TAG="unknown" -FROM golang:1.20-alpine AS builder +FROM golang:1.21-alpine3.19 AS builder ARG REPO_BUILD_TAG WORKDIR /go/src/github.com/woblerr/authlog_exporter COPY . . @@ -11,7 +11,7 @@ RUN apk update \ -ldflags "-X main.version=${REPO_BUILD_TAG}" \ -o authlog_exporter authlog_exporter.go -FROM alpine:3.17 +FROM alpine:3.19 ARG REPO_BUILD_TAG RUN apk add --no-cache --update ca-certificates \ && rm -rf /var/cache/apk/* diff --git a/Dockerfile.artifacts b/Dockerfile.artifacts index 49e795f..db5a864 100644 --- a/Dockerfile.artifacts +++ b/Dockerfile.artifacts @@ -1,4 +1,4 @@ -FROM goreleaser/goreleaser:v1.20.0 as builder +FROM goreleaser/goreleaser:v1.24.0 as builder WORKDIR /build COPY . /build RUN goreleaser release --snapshot --skip-publish --rm-dist diff --git a/authlog_exporter_test.go b/authlog_exporter_test.go index ba67b8d..6901dc0 100644 --- a/authlog_exporter_test.go +++ b/authlog_exporter_test.go @@ -41,7 +41,7 @@ func TestMain(t *testing.T) { if err != nil { t.Errorf("\nGet error during read resp body:\n%v", err) } - if len(string(b)) == 0 { + if string(b) == "" { t.Errorf("\nGet zero body:\n%s", string(b)) } } diff --git a/go.mod b/go.mod index c390e53..ace1d3c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/woblerr/authlog_exporter -go 1.20 +go 1.21 require ( github.com/alecthomas/kingpin/v2 v2.3.2 diff --git a/go.sum b/go.sum index 7d3eb8b..2c6e699 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,7 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.0 h1:NO5hkcB+srp1x6QmwvNZLeaOgbM8cmBTN32THzjvu2k= github.com/fsnotify/fsnotify v1.5.0/go.mod h1:BX0DCEr5pT4jm2CnQdVP1lFV521fcCNcyEeNp4DQQDk= @@ -27,9 +28,11 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= @@ -61,6 +64,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -94,6 +98,7 @@ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGm google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -101,3 +106,4 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=