From 542fafde73f7d75533775aa3e951e55b3fe6d3a8 Mon Sep 17 00:00:00 2001 From: Janar Juusu Date: Fri, 19 Apr 2024 16:04:59 +0300 Subject: [PATCH 1/3] ci: remove double lint/test run Signed-off-by: Janar Juusu --- .github/workflows/golangci-lint.yml | 8 -------- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 8 +------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1041ca2..0dddd5c 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -8,14 +8,6 @@ on: - "scripts/errcheck_excludes.txt" - ".github/workflows/golangci-lint.yml" - ".golangci.yml" - pull_request: - paths: - - "go.sum" - - "go.mod" - - "**.go" - - "scripts/errcheck_excludes.txt" - - ".github/workflows/golangci-lint.yml" - - ".golangci.yml" jobs: golangci: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4f5661..0d95e93 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: '>=1.20.2' + go-version: '>=1.22' cache: true - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 990ce8f..e7e9622 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,12 +7,6 @@ on: - "go.mod" - "**.go" - ".github/workflows/test.yml" - pull_request: - paths: - - "go.sum" - - "go.mod" - - "**.go" - - ".github/workflows/test.yml" jobs: test: @@ -23,7 +17,7 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version: '^1.22' - name: Test run: go test ./... From 558c7155c2afc049c3c27ea1b4f96db48cc1faa5 Mon Sep 17 00:00:00 2001 From: Janar Juusu Date: Fri, 19 Apr 2024 16:05:27 +0300 Subject: [PATCH 2/3] chore: fix golangci.yml config Signed-off-by: Janar Juusu --- .golangci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index b235843..a685c6b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,8 @@ run: modules-download-mode: readonly - skip-dirs: + +issues: + exclude-dirs: - vendor linters: From 5ffe7ed2384cf9a1858f350021d0e1e6e256f5a0 Mon Sep 17 00:00:00 2001 From: Janar Juusu Date: Mon, 22 Apr 2024 20:18:14 +0300 Subject: [PATCH 3/3] fix: nosec issue Signed-off-by: Janar Juusu --- ttn_exporter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ttn_exporter.go b/ttn_exporter.go index ea5e76d..be89c44 100644 --- a/ttn_exporter.go +++ b/ttn_exporter.go @@ -87,7 +87,7 @@ func NewExporter(uri string, apiKey string, sslVerify bool, timeout time.Duratio if !strings.HasPrefix(uri, "https://") && !strings.HasPrefix(uri, "http://") { return nil, errors.New("invalid URI scheme") } - /* #nosec G402 -- allow insecure TLS when requested by user */ + return &Exporter{ URI: uri, apiKey: apiKey, @@ -95,7 +95,7 @@ func NewExporter(uri string, apiKey string, sslVerify bool, timeout time.Duratio Timeout: timeout, Transport: &http.Transport{ TLSClientConfig: &tls.Config{ - InsecureSkipVerify: !sslVerify, + InsecureSkipVerify: !sslVerify, // #nosec G402 -- allow insecure TLS when requested by user }, }, },