diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 17a9e68..ed0435c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -120,7 +120,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} # https://github.com/golangci/golangci-lint/issues/828 - generate-matrix: + generate-pkgs-matrix: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} @@ -132,12 +132,12 @@ jobs: DIRECTORIES=$(find . -not -path "*/vendor/*" -type f -name go.mod -exec sh -c 'echo $(dirname {})' \; | jq -R -s -c 'split("\n")[:-1]') echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT - golangci-lint: - needs: generate-matrix + lint: + needs: generate-pkgs-matrix runs-on: ubuntu-latest strategy: matrix: - modules: ${{fromJson(needs.generate-matrix.outputs.matrix)}} + modules: ${{fromJson(needs.generate-pkgs-matrix.outputs.matrix)}} steps: - name: Fetch Repository uses: actions/checkout@v4 diff --git a/.golangci.yml b/.golangci.yml index 214caba..db3db84 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,3 @@ -linters-settings: - enable-all: true - run: skip-dirs: - trm/mock @@ -68,9 +65,6 @@ linters: issues: exclude-use-default: false - errcheck: - check-type-assertions: true - check-blank: true exclude: - ST1000 # ST1000: at least one file in a package should have a package comment exclude-rules: @@ -110,13 +104,13 @@ issues: - gochecknoglobals source: "DefaultCtxGetter" - &internal_text - path: ^internal + path: (^trm/internal|^internal) text: "var-naming: don't use an underscore in package name" - <<: *internal_text text: "package-comments: should have a package comment" - <<: *internal_text text: "ST1003: should not use underscores in package names" - - path: (_test\.go|^internal) + - path: (_test\.go|^trm/internal|^internal) linters: - funlen - gochecknoglobals diff --git a/sh/lint.sh b/sh/lint.sh index 395009e..72c88e3 100755 --- a/sh/lint.sh +++ b/sh/lint.sh @@ -8,13 +8,13 @@ cd ../ ROOT=$(pwd) echo "\ntrm" -cd trm && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m $@ +cd trm && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m --path-prefix=trm $@ cd $ROOT for driver in $drivers; do if [ -d "$driver" ]; then echo "\n$driver" - cd $driver && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m $@ + cd $driver && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m --path-prefix=$driver $@ cd $ROOT fi