From 3b7c95ffe2fb36b1406175dfe48296d435c94e42 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Wed, 19 Feb 2025 12:47:12 +0530 Subject: [PATCH 1/3] Enable Linting --- .github/workflows/test.yml | 5 ++--- .golangci.yml | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a867e784b..c3c64a7884 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,13 +45,12 @@ jobs: path: ${{ steps.go-cache-paths.outputs.go-build }} key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} - # TODO fix this step (cant find the path to golangci.yml) - name: golangci-lint uses: golangci/golangci-lint-action@v6 - continue-on-error: true # we dont want to enforce just yet with: - version: v1.52.2 + version: latest args: --timeout=15m --config=.golangci.yml + working-directory: steampipe skip-pkg-cache: true skip-build-cache: true diff --git a/.golangci.yml b/.golangci.yml index 5c9b05b15d..96176398ca 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,7 +14,6 @@ linters: - asciicheck - bidichk - durationcheck - - exportloopref - forbidigo - gocritic - gocheckcompilerdirectives @@ -40,5 +39,7 @@ linters-settings: run: timeout: 5m - skip-dirs: + +issues: + exclude-dirs: - "tests/acceptance" From ccca85b8a4562848bbc2f0c48b00f2560ae0cdc2 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Wed, 19 Feb 2025 12:55:13 +0530 Subject: [PATCH 2/3] skip cache --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3c64a7884..76a5edce2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,8 +51,7 @@ jobs: version: latest args: --timeout=15m --config=.golangci.yml working-directory: steampipe - skip-pkg-cache: true - skip-build-cache: true + skip-cache: true - name: Run CLI Unit Tests run: | From bf157e1b4857d5c68a8996bc9716f191c38ea6e6 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Wed, 19 Feb 2025 16:55:24 +0530 Subject: [PATCH 3/3] update golangci config --- .golangci.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 96176398ca..eaa5b4e937 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,6 +11,7 @@ linters: - unused # other rules - asasalint + - depguard - asciicheck - bidichk - durationcheck @@ -30,6 +31,13 @@ linters-settings: require-explanation: true require-specific: true + forbidigo: + forbid: + - "^(fmt\\.Print(|f|ln)|print|println)$" + - "^(fmt\\.Fprint(|f|ln)|print|println)$" + - '^zap\.Error$' + - '^grpc\.(Header|Trailer)$' # easy to misuse and create a data race + gocritic: disabled-checks: - ifElseChain # style @@ -37,6 +45,25 @@ linters-settings: - assignOp # style - commentFormatting # style + depguard: + rules: + # Name of a rule. + main: + # List of file globs that will match this list of settings to compare against. + # Default: $all + # files: + # - "!**/*_a _file.go" + # List of allowed packages. + # allow: + # - $gostd + # - github.com/OpenPeeDeeP + # Packages that are not allowed where the value is a suggestion. + deny: + - pkg: "go.uber.org/zap" + desc: do not use Uber zap directly, use the fplog package instead + - pkg: "github.com/pkg/errors" + desc: Should be replaced by standard lib errors package + run: timeout: 5m