Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golangci/golangci-lint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d9df7005f20a049f0ba44e97d00e7317ba6b197b
Choose a base ref
..
head repository: golangci/golangci-lint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d3ec33e7a14fa30f18aaa7cc74e5f667047356b2
Choose a head ref
Showing with 10,233 additions and 7,762 deletions.
  1. +1 −0 .gitattributes
  2. +3 −3 .github/contributors/package-lock.json
  3. +1 −1 .github/dependabot.yml
  4. +3 −3 .github/peril/package-lock.json
  5. +59 −0 .github/workflows/codeql.yaml
  6. +4 −4 .github/workflows/pr-extra.yml
  7. +21 −7 .github/workflows/pr.yml
  8. +67 −3 .github/workflows/tag.yml
  9. +139 −24 .golangci.example.yml
  10. +8 −2 .golangci.yml
  11. +8 −16 .goreleaser.yml
  12. +11 −0 .nancy-ignore
  13. +171 −3 CHANGELOG.md
  14. +4 −22 Makefile
  15. +293 −242 README.md
  16. +26 −2 assets/github-action-config.json
  17. +13 −2 build/Dockerfile
  18. +17 −2 build/Dockerfile.alpine
  19. +6,020 −6,254 docs/package-lock.json
  20. +31 −31 docs/package.json
  21. +1 −0 docs/src/components/ResponsiveContainer.js
  22. +1 −1 docs/src/components/SearchBar/algolia.css
  23. +0 −2 docs/src/config/sidebar.yml
  24. +2 −2 docs/src/docs/contributing/new-linters.mdx
  25. +1 −1 docs/src/docs/contributing/website.mdx
  26. +0 −78 docs/src/docs/product/comparison.mdx
  27. +1 −0 docs/src/docs/usage/configuration.mdx
  28. +17 −1 docs/src/docs/usage/install/index.mdx
  29. +1 −0 docs/src/docs/usage/integrations.mdx
  30. +3 −2 docs/src/docs/usage/performance.mdx
  31. +1 −0 docs/src/lib/icons.js
  32. +1 −1 docs/template_data.state
  33. +45 −28 go.mod
  34. +153 −86 go.sum
  35. +8 −0 netlify.toml
  36. +32 −0 pkg/commands/completion.go
  37. +9 −1 pkg/commands/help.go
  38. +18 −5 pkg/commands/run.go
  39. +140 −23 pkg/config/config.go
  40. +13 −8 pkg/config/config_gocritic.go
  41. +36 −0 pkg/config/config_test.go
  42. +1 −1 pkg/golinters/asciicheck.go
  43. +39 −0 pkg/golinters/cyclop.go
  44. +15 −0 pkg/golinters/durationcheck.go
  45. +27 −0 pkg/golinters/errorlint.go
  46. +1 −0 pkg/golinters/exhaustive.go
  47. +31 −0 pkg/golinters/exhaustivestruct.go
  48. +70 −0 pkg/golinters/forbidigo.go
  49. +1 −1 pkg/golinters/goanalysis/runner.go
  50. +17 −87 pkg/golinters/gochecknoglobals.go
  51. +0 −1 pkg/golinters/gochecknoinits.go
  52. +0 −1 pkg/golinters/gocognit.go
  53. +10 −4 pkg/golinters/goconst.go
  54. +4 −1 pkg/golinters/gocritic.go
  55. +4 −12 pkg/golinters/gocyclo.go
  56. +20 −2 pkg/golinters/godot.go
  57. +6 −2 pkg/golinters/goheader.go
  58. +1 −1 pkg/golinters/gomnd.go
  59. +4 −4 pkg/golinters/gomodguard.go
  60. +28 −0 pkg/golinters/ifshort.go
  61. +60 −0 pkg/golinters/makezero.go
  62. +78 −75 pkg/golinters/nolintlint/nolintlint.go
  63. +102 −65 pkg/golinters/nolintlint/nolintlint_test.go
  64. +21 −0 pkg/golinters/paralleltest.go
  65. +2 −2 pkg/golinters/prealloc.go
  66. +26 −0 pkg/golinters/predeclared.go
  67. +259 −0 pkg/golinters/revive.go
  68. +0 −1 pkg/golinters/scopelint.go
  69. +61 −0 pkg/golinters/thelper.go
  70. +21 −0 pkg/golinters/tparallel.go
  71. +19 −0 pkg/golinters/wrapcheck.go
  72. +1 −0 pkg/golinters/wsl.go
  73. +81 −2 pkg/lint/lintersdb/manager.go
  74. +9 −1 pkg/lint/lintersdb/validator.go
  75. +1 −1 pkg/lint/load.go
  76. +16 −7 pkg/lint/runner.go
  77. +1 −1 pkg/printers/github.go
  78. +2 −1 pkg/printers/text.go
  79. +2 −2 pkg/result/processors/autogenerated_exclude.go
  80. +2 −6 pkg/result/processors/nolint.go
  81. +22 −0 pkg/result/processors/nolint_test.go
  82. +1 −1 pkg/result/processors/severity_rules.go
  83. +31 −0 pkg/result/processors/severity_rules_test.go
  84. +5 −0 pkg/result/processors/testdata/nolint_apply_to_unknown.go
  85. +4 −0 scripts/expand_website_templates/main.go
  86. +60 −53 test/errchk.go
  87. +80 −15 test/linters_test.go
  88. +5 −1 test/testdata/asciicheck.go
  89. +3 −0 test/testdata/configs/default_exclude.yml
  90. 0 test/testdata/configs/{exhaustive.yml → exhaustive_default.yml}
  91. +4 −0 test/testdata/configs/forbidigo.yml
  92. +4 −0 test/testdata/configs/predeclared.yml
  93. +19 −0 test/testdata/configs/revive.yml
  94. +15 −0 test/testdata/cyclop.go
  95. +20 −0 test/testdata/default_exclude.go
  96. +38 −0 test/testdata/durationcheck.go
  97. +90 −0 test/testdata/errorlint.go
  98. +26 −0 test/testdata/errorlint_errorf.go
  99. +1 −1 test/testdata/exhaustive_default.go
  100. +23 −0 test/testdata/exhaustive_generated.go
  101. +40 −0 test/testdata/exhaustivestruct.go
  102. +113 −0 test/testdata/exhaustivestruct_custom.go
  103. +11 −9 test/testdata/exportloopref.go
  104. +2 −2 test/testdata/fix/out/gofumpt.go
  105. +9 −0 test/testdata/forbidigo_example.go
  106. +9 −0 test/testdata/forbidigo_example_test.go
  107. +9 −0 test/testdata/forbidigo_include_godoc_examples_test.go
  108. +2 −2 test/testdata/funlen.go
  109. +1 −1 test/testdata/go-header_bad.go
  110. +7 −1 test/testdata/gochecknoglobals.go
  111. +1 −0 test/testdata/goconst.go
  112. +17 −0 test/testdata/goconst_calls_enabled.go
  113. +1 −1 test/testdata/gocritic.go
  114. +3 −1 test/testdata/gocyclo.go
  115. +1 −1 test/testdata/godot.go
  116. +7 −7 test/testdata/godox.go
  117. +3 −3 test/testdata/goerr113.go
  118. +1 −1 test/testdata/gofmt_no_simplify.go
  119. +1 −1 test/testdata/gofumpt.go
  120. +2 −2 test/testdata/gofumpt_with_extra.go
  121. +2 −2 test/testdata/gomnd.go
  122. +1 −1 test/testdata/gomodguard.go
  123. +10 −10 test/testdata/{govet/default.go → govet.go}
  124. +0 −14 test/testdata/govet/ifaceassert.go
  125. +14 −0 test/testdata/govet_ifaceassert.go
  126. +11 −0 test/testdata/ifshort.go
  127. +14 −0 test/testdata/makezero.go
  128. +15 −0 test/testdata/makezero_always.go
  129. +5 −5 test/testdata/nestif.go
  130. +24 −24 test/testdata/noctx.go
  131. +1 −0 test/testdata/nolintlint_unused.go
  132. +24 −0 test/testdata/paralleltest.go
  133. +27 −0 test/testdata/predeclared.go
  134. +28 −0 test/testdata/predeclared_custom.go
  135. +13 −0 test/testdata/revive.go
  136. +26 −0 test/testdata/rowserrcheck.go
  137. +0 −85 test/testdata/sqlclosecheck.go
  138. +7 −1 test/testdata/staticcheck_in_megacheck.go
  139. +0 −8 test/testdata/stylecheck_not_in_megacheck.go
  140. +0 −6 test/testdata/testpackage_internal_test.go
  141. +62 −0 test/testdata/thelper.go
  142. +16 −0 test/testdata/tparallel/happy_path_test.go
  143. +12 −0 test/testdata/tparallel/missing_subtest_test.go
  144. +11 −0 test/testdata/tparallel/missing_toplevel_test.go
  145. +15 −0 test/testdata/wrapcheck.go
  146. +8 −1 test/testdata/wsl.go
  147. +4 −7 tools/go.mod
  148. +763 −350 tools/go.sum
  149. +3 −3 tools/package-lock.json
  150. +0 −1 tools/tools.go
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go.sum linguist-generated
6 changes: 3 additions & 3 deletions .github/contributors/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -30,6 +30,6 @@ updates:
- package-ecosystem: npm
directory: "/docs"
schedule:
interval: weekly
interval: monthly
reviewers:
- "golangci/team"
6 changes: 3 additions & 3 deletions .github/peril/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '0 17 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
# TODO: Enable for javascript later
language: [ 'go' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Use manual build instead of auto build
- run: make build test

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
8 changes: 4 additions & 4 deletions .github/workflows/pr-extra.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
# We cannot use nancy-github-action because it is outdated, so it's better to use the latest
# docker image for the validation
- name: nancy
run: go list -json -m all | docker run -i sonatypecommunity/nancy:v0.3
- name: Run go list
run: go list -json -m all > go.list
- name: Nancy
uses: sonatype-nexus-community/nancy-github-action@1.0.1
28 changes: 21 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -8,14 +8,29 @@ on:
- master
pull_request:
jobs:
# Check if there any dirty change for go mod tidy
go-mod:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
# We already run the current golangci-lint in tests, but here we test
# our GitHub action with the latest stable golangci-lint.
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v2.4.0
with:
version: latest
tests-on-windows:
@@ -26,7 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15 # test only the latest go version to speed up CI
go-version: 1.16 # test only the latest go version to speed up CI
- name: Run tests
run: make.exe test
continue-on-error: true
@@ -38,26 +53,25 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15 # test only the latest go version to speed up CI
go-version: 1.16 # test only the latest go version to speed up CI
- name: Run tests
run: make test
continue-on-error: true
tests-on-unix:
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
runs-on: ubuntu-latest
strategy:
matrix:
golang:
- 1.13
- 1.14
- 1.15
- 1.16
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.golang }}
- uses: actions/cache@v2
- uses: actions/cache@v2.1.4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
@@ -78,6 +92,6 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.16
- name: Check generated files are up to date
run: make fast_check_generated
70 changes: 67 additions & 3 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -14,15 +14,79 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.16
- name: Unshallow
run: git fetch --prune --unshallow
- name: Login do docker.io
run: docker login -u golangci -p ${{ secrets.GOLANGCI_LINT_DOCKER_TOKEN }}

- name: Create release
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}

docker-release:
needs: [ release ]
runs-on: ubuntu-latest
strategy:
matrix:
target:
- Dockerfile: build/Dockerfile
- Dockerfile: build/Dockerfile.alpine
steps:
- uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Unshallow
run: git fetch --prune --unshallow

- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
MAJOR=${TAG%.*}
SHORT_COMMIT=${GITHUB_SHA::8}
DATE=$(date '+%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=major_tag::${MAJOR}
echo ::set-output name=short_commit::${SHORT_COMMIT}
echo ::set-output name=date::${DATE}
if [[ ${{ matrix.target.Dockerfile }} == *"alpine"* ]]; then
echo ::set-output name=full_tag_name::${TAG}-alpine
echo ::set-output name=full_major_tag::${MAJOR}-alpine
echo ::set-output name=latest_tag::latest-alpine
else
echo ::set-output name=full_tag_name::${TAG}
echo ::set-output name=full_major_tag::${MAJOR}
echo ::set-output name=latest_tag::latest
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login do docker.io
run: docker login -u golangci -p ${{ secrets.GOLANGCI_LINT_DOCKER_TOKEN }}

- name: Build and publish ${{ matrix.target.Dockerfile }}
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.target.Dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ steps.prepare.outputs.tag_name }}
SHORT_COMMIT=${{ steps.prepare.outputs.short_commit }}
DATE=${{ steps.prepare.outputs.date }}
tags: |
golangci/golangci-lint:${{ steps.prepare.outputs.full_tag_name }}
golangci/golangci-lint:${{ steps.prepare.outputs.full_major_tag }}
golangci/golangci-lint:${{ steps.prepare.outputs.latest_tag }}
Loading