Skip to content

Commit

Permalink
Merge branch 'master' into update-errcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vilgelm committed Feb 24, 2021
2 parents 6db056f + 25332f5 commit b5fbf96
Show file tree
Hide file tree
Showing 122 changed files with 8,448 additions and 7,381 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-extra.yml
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Run go list
run: go list -json -m all > go.list
- name: Nancy
uses: sonatype-nexus-community/nancy-github-action@1.0.1
uses: sonatype-nexus-community/nancy-github-action@v1.0.2
14 changes: 7 additions & 7 deletions .github/workflows/pr.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Check go mod
Expand All @@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v2.3.0
uses: golangci/golangci-lint-action@v2.4.0
with:
version: latest
tests-on-windows:
Expand All @@ -41,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
Expand All @@ -53,7 +53,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 test
tests-on-unix:
Expand All @@ -62,16 +62,16 @@ jobs:
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') }}
Expand All @@ -92,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
4 changes: 2 additions & 2 deletions .github/workflows/tag.yml
Expand Up @@ -14,7 +14,7 @@ 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

Expand All @@ -40,7 +40,7 @@ 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
Expand Down
85 changes: 67 additions & 18 deletions .golangci.example.yml
Expand Up @@ -51,7 +51,7 @@ run:
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
modules-download-mode: readonly|release|vendor
modules-download-mode: readonly|vendor|mod

# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
Expand Down Expand Up @@ -111,6 +111,12 @@ linters-settings:
# 'default' case is present, even if all enum members aren't listed in the
# switch
default-signifies-exhaustive: false
exhaustivestruct:
struct-patterns:
- '*.Test'
- '*.Test2'
- '*.Embedded'
- '*.External'
funlen:
lines: 60
statements: 40
Expand Down Expand Up @@ -152,10 +158,10 @@ linters-settings:
# Settings passed to gocritic.
# The settings key is the name of a supported gocritic checker.
# The list of supported checkers can be find in https://go-critic.github.io/overview.
settings:
settings:
captLocal: # must be valid enabled check name
# whether to restrict checker to params only (default true)
paramsOnly: true
paramsOnly: true
elseif:
# whether to skip balanced if-else pairs (default true)
skipBalanced: true
Expand Down Expand Up @@ -190,9 +196,21 @@ linters-settings:
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10

cyclop:
# the maximal code complexity to report
max-complexity: 10
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
package-average: 0.0
# should ignore tests (default false)
skip-tests: false
godot:
# comments to be checked: `declarations`, `toplevel`, or `all`
scope: declarations
# list of regexps for excluding particular comment lines from check
exclude:
# example: exclude comments which contain numbers
# - '[0-9]+'
# check that each sentence starts with a capital letter
capital: false
godox:
Expand All @@ -209,27 +227,28 @@ linters-settings:
values:
const:
# define here const type values in format k:v, for example:
# YEAR: 2020
# COMPANY: MY COMPANY
regexp:
# define here regexp type values, for example
# AUTHOR: .*@mycompany\.com
template:
template: # |
# put here copyright header template for source code files, for example:
# {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
# SPDX-License-Identifier: Apache-2.0

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
template-path:
# also as alternative of directive 'template' you may put the path to file with the template source
goimports:
Expand Down Expand Up @@ -278,6 +297,7 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf

# enable or disable analyzers by name
# run `go tool vet help` to see all analyzers
enable:
- atomicalign
enable-all: false
Expand All @@ -292,6 +312,12 @@ linters-settings:
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
ifshort:
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
# Has higher priority than max-decl-chars.
max-decl-lines: 1
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
max-decl-chars: 30
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
Expand Down Expand Up @@ -320,6 +346,11 @@ linters-settings:
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
predeclared:
# comma-separated list of predeclared identifiers to not report on
ignore: ""
# include method names and field names (i.e., qualified names) in checks
q: false
nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
Expand All @@ -334,6 +365,13 @@ linters-settings:
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
revive:
# see https://github.com/mgechev/revive#available-rules for details.
ignore-generated-header: true
severity: warning
rules:
- name: indent-error-flow
severity: warning
testpackage:
# regexp pattern to skip files
skip-regexp: (export|internal)_test\.go
Expand All @@ -348,6 +386,10 @@ linters-settings:
first: true
name: true
begin: true
tb:
first: true
name: true
begin: true
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
Expand All @@ -370,6 +412,8 @@ linters-settings:
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow assignments to be cuddled with anything. Default is false.
allow-assign-and-anything: false
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.
Expand Down Expand Up @@ -398,6 +442,8 @@ linters-settings:
- fmt.Errorf # consider errors.Errorf in github.com/pkg/errors
- fmt.Print.* # too much log noise
- ginkgo\\.F.* # these are used just for local development
# Exclude godoc examples from forbidigo checks. Default is true.
exclude_godoc_examples: false

# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
# for more info.
Expand Down Expand Up @@ -494,6 +540,9 @@ issues:
# Show only new issues created in git patch with set file path.
new-from-patch: path/to/patch/file

# Fix found issues (if it's supported by the linter)
fix: true

severity:
# Default value is empty string.
# Set the default severity for issues. If severity rules are defined and the issues
Expand Down
22 changes: 21 additions & 1 deletion .golangci.yml
Expand Up @@ -88,7 +88,6 @@ linters:
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- nakedret
Expand All @@ -113,10 +112,12 @@ linters:
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - revive
# - wsl

issues:
Expand All @@ -131,6 +132,25 @@ issues:
- gocritic
text: "unnecessaryDefer:"

# TODO temporary rule, must be removed
# seems related to v0.34.1, but I was not able to reproduce locally,
# I was also not able to reproduce in the CI of a fork,
# only the golangci-lint CI seems to be affected by this invalid analysis.
- path: pkg/golinters/scopelint.go
text: 'directive `//nolint:interfacer` is unused for linter interfacer'

# TODO temporary rule, must be removed
# related to https://github.com/golangci/golangci-lint/pull/1756
# must be replaced by '//nolint:staticcheck // require changes in github.com/OpenPeeDeeP/depguard'
- path: pkg/golinters/depguard.go
text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'

# TODO temporary rule, must be removed
# related to https://github.com/golangci/golangci-lint/pull/1756
# must be replaced by '///nolint:staticcheck // it's an adapter for golang.org/x/tools/go/packages'
- path: pkg/golinters/goanalysis/adapters.go
text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'

run:
skip-dirs:
- test/testdata_etc
Expand Down
5 changes: 5 additions & 0 deletions .goreleaser.yml
Expand Up @@ -25,6 +25,8 @@ builds:
goarm:
- 6
- 7
gomips:
- hardfloat
env:
- CGO_ENABLED=0
ignore:
Expand All @@ -33,6 +35,8 @@ builds:
- goos: freebsd
goarch: arm64
main: ./cmd/golangci-lint/
flags:
- -trimpath
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}

archives:
Expand Down Expand Up @@ -60,6 +64,7 @@ changelog:
- '^test:'
- '^dev:'
- 'README'
- 'build\(deps\): bump .* in /docs \(#\d+\)'
- Merge pull request
- Merge branch

Expand Down

0 comments on commit b5fbf96

Please sign in to comment.