Skip to content

Commit be241f8

Browse files
authored
Merge branch 'master' into forbidigo-update
2 parents f20d983 + bfa2006 commit be241f8

File tree

182 files changed

+3978
-955
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+3978
-955
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
See [contibuting quick start](https://golangci-lint.run/contributing/quick-start/) on our website.
1+
See [contributing quick start](https://golangci-lint.run/contributing/quick-start/) on our website.

.github/contributors/generate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const main = async () => {
124124
fossabot: true,
125125
golangcibot: true,
126126
kortschak: true,
127+
"golanci-releaser": true,
127128
}
128129

129130
const res: DataJSON = {

.github/workflows/post-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- name: Install Go
15-
uses: actions/setup-go@v3
15+
uses: actions/setup-go@v4
1616
with:
1717
# https://github.com/actions/setup-go#supported-version-syntax
1818
# ex:

.github/workflows/pr-extra.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- uses: actions/setup-go@v3
14+
- uses: actions/setup-go@v4
1515
with:
1616
# https://github.com/actions/setup-go#supported-version-syntax
1717
# ex:
@@ -21,4 +21,4 @@ jobs:
2121
- name: Run go list
2222
run: go list -json -m all > go.list
2323
- name: Nancy
24-
uses: sonatype-nexus-community/nancy-github-action@v1.0.2
24+
uses: sonatype-nexus-community/nancy-github-action@v1.0.3

.github/workflows/pr.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Install Go
17-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@v4
1818
with:
1919
# https://github.com/actions/setup-go#supported-version-syntax
2020
# ex:
@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v3
3737
- name: Install Go
38-
uses: actions/setup-go@v3
38+
uses: actions/setup-go@v4
3939
with:
4040
# https://github.com/actions/setup-go#supported-version-syntax
4141
# ex:
@@ -56,7 +56,7 @@ jobs:
5656
steps:
5757
- uses: actions/checkout@v3
5858
- name: Install Go
59-
uses: actions/setup-go@v3
59+
uses: actions/setup-go@v4
6060
with:
6161
# https://github.com/actions/setup-go#supported-version-syntax
6262
# ex:
@@ -72,7 +72,7 @@ jobs:
7272
steps:
7373
- uses: actions/checkout@v3
7474
- name: Install Go
75-
uses: actions/setup-go@v3
75+
uses: actions/setup-go@v4
7676
with:
7777
# https://github.com/actions/setup-go#supported-version-syntax
7878
# ex:
@@ -93,7 +93,7 @@ jobs:
9393
steps:
9494
- uses: actions/checkout@v3
9595
- name: Install Go
96-
uses: actions/setup-go@v3
96+
uses: actions/setup-go@v4
9797
with:
9898
# https://github.com/actions/setup-go#supported-version-syntax
9999
# ex:
@@ -120,7 +120,7 @@ jobs:
120120
- name: Unshallow
121121
run: git fetch --prune --unshallow
122122
- name: Install Go
123-
uses: actions/setup-go@v3
123+
uses: actions/setup-go@v4
124124
with:
125125
# https://github.com/actions/setup-go#supported-version-syntax
126126
# ex:

.github/workflows/tag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- name: Install Go
15-
uses: actions/setup-go@v3
15+
uses: actions/setup-go@v4
1616
with:
1717
# https://github.com/actions/setup-go#supported-version-syntax
1818
# ex:
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@v3
4343

4444
- name: Install Go
45-
uses: actions/setup-go@v3
45+
uses: actions/setup-go@v4
4646
with:
4747
# https://github.com/actions/setup-go#supported-version-syntax
4848
# ex:

.golangci.reference.yml

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ run:
2727
- mytag
2828

2929
# Which dirs to skip: issues from them won't be reported.
30-
# Can use regexp here: `generated.*`, regexp is applied on full path.
30+
# Can use regexp here: `generated.*`, regexp is applied on full path,
31+
# including the path prefix if one is set.
3132
# Default value is empty list,
3233
# but default dirs are skipped independently of this option's value (see skip-dirs-use-default).
3334
# "/" will be replaced by current OS file path separator to properly work on Windows.
@@ -75,7 +76,7 @@ run:
7576

7677
# output configuration options
7778
output:
78-
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity
79+
# Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity
7980
#
8081
# Multiple can be specified by separating them by comma, output can be provided
8182
# for each of them by separating format name and path by colon symbol.
@@ -435,6 +436,18 @@ linters-settings:
435436
# Default: false
436437
suppress-err-assertion: true
437438

439+
# Suppress the wrong comparison assertion warning.
440+
# Default: false
441+
suppress-compare-assertion: true
442+
443+
# Suppress the function all in async assertion warning.
444+
# Default: false
445+
suppress-async-assertion: true
446+
447+
# Don't trigger warnings for HaveLen(0)
448+
# Default: false
449+
allow-havelen-zero: true
450+
438451
gocognit:
439452
# Minimal code complexity to report.
440453
# Default: 30 (but we recommend 10-20)
@@ -634,8 +647,6 @@ linters-settings:
634647
replacement: 'a[b:]'
635648

636649
gofumpt:
637-
# Select the Go version to target.
638-
# Default: "1.15"
639650
# Deprecated: use the global `run.go` instead.
640651
lang-version: "1.17"
641652

@@ -779,8 +790,6 @@ linters-settings:
779790
local_replace_directives: false
780791

781792
gosimple:
782-
# Select the Go version to target.
783-
# Default: 1.13
784793
# Deprecated: use the global `run.go` instead.
785794
go: "1.15"
786795
# Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
@@ -960,6 +969,37 @@ linters-settings:
960969
# Default: "0600"
961970
G306: "0600"
962971

972+
gosmopolitan:
973+
# Allow and ignore `time.Local` usages.
974+
#
975+
# Default: false
976+
allow-time-local: true
977+
# List of fully qualified names in the `full/pkg/path.name` form, to act as "i18n escape hatches".
978+
# String literals inside call-like expressions to, or struct literals of those names,
979+
# are exempt from the writing system check.
980+
#
981+
# Default: []
982+
escape-hatches:
983+
- 'github.com/nicksnyder/go-i18n/v2/i18n.Message'
984+
- 'example.com/your/project/i18n/markers.Raw'
985+
- 'example.com/your/project/i18n/markers.OK'
986+
- 'example.com/your/project/i18n/markers.TODO'
987+
- 'command-line-arguments.Simple'
988+
# Ignore test files.
989+
#
990+
# Default: true
991+
ignore-tests: false
992+
# List of Unicode scripts to watch for any usage in string literals.
993+
# https://pkg.go.dev/unicode#pkg-variables
994+
#
995+
# Default: ["Han"]
996+
watch-for-scripts:
997+
- Devanagari
998+
- Han
999+
- Hangul
1000+
- Hiragana
1001+
- Katakana
1002+
9631003
govet:
9641004
# Report about shadowed variables.
9651005
# Default: false
@@ -1618,6 +1658,9 @@ linters-settings:
16181658
- must not contain line breaks
16191659
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
16201660
- name: struct-tag
1661+
arguments:
1662+
- "json,inline"
1663+
- "bson,outline,gnu"
16211664
severity: warning
16221665
disabled: false
16231666
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else
@@ -1694,17 +1737,13 @@ linters-settings:
16941737
- github.com/jmoiron/sqlx
16951738

16961739
staticcheck:
1697-
# Select the Go version to target.
1698-
# Default: "1.13"
16991740
# Deprecated: use the global `run.go` instead.
17001741
go: "1.15"
17011742
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
17021743
# Default: ["*"]
17031744
checks: [ "all" ]
17041745

17051746
stylecheck:
1706-
# Select the Go version to target.
1707-
# Default: 1.13
17081747
# Deprecated: use the global `run.go` instead.
17091748
go: "1.15"
17101749
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
@@ -1721,6 +1760,39 @@ linters-settings:
17211760
# Default: ["200", "400", "404", "500"]
17221761
http-status-code-whitelist: [ "200", "400", "404", "500" ]
17231762

1763+
tagalign:
1764+
# Align and sort can be used together or separately.
1765+
#
1766+
# Whether enable align. If true, the struct tags will be aligned.
1767+
# eg:
1768+
# type FooBar struct {
1769+
# Bar string `json:"bar" validate:"required"`
1770+
# FooFoo int8 `json:"foo_foo" validate:"required"`
1771+
# }
1772+
# will be formatted to:
1773+
# type FooBar struct {
1774+
# Bar string `json:"bar" validate:"required"`
1775+
# FooFoo int8 `json:"foo_foo" validate:"required"`
1776+
# }
1777+
# Default: true.
1778+
align: false
1779+
# Whether enable tags sort.
1780+
# If true, the tags will be sorted by name in ascending order.
1781+
# eg: `xml:"bar" json:"bar" validate:"required"` -> `json:"bar" validate:"required" xml:"bar"`
1782+
# Default: true
1783+
sort: false
1784+
# Specify the order of tags, the other tags will be sorted by name.
1785+
# This option will be ignored if `sort` is false.
1786+
# Default: []
1787+
order:
1788+
- json
1789+
- yaml
1790+
- yml
1791+
- toml
1792+
- mapstructure
1793+
- binding
1794+
- validate
1795+
17241796
tagliatelle:
17251797
# Check the struct tag name case.
17261798
case:
@@ -2062,6 +2134,7 @@ linters:
20622134
- goprintffuncname
20632135
- gosec
20642136
- gosimple
2137+
- gosmopolitan
20652138
- govet
20662139
- grouper
20672140
- ifshort
@@ -2099,6 +2172,7 @@ linters:
20992172
- staticcheck
21002173
- structcheck
21012174
- stylecheck
2175+
- tagalign
21022176
- tagliatelle
21032177
- tenv
21042178
- testableexamples
@@ -2172,6 +2246,7 @@ linters:
21722246
- goprintffuncname
21732247
- gosec
21742248
- gosimple
2249+
- gosmopolitan
21752250
- govet
21762251
- grouper
21772252
- ifshort
@@ -2209,6 +2284,7 @@ linters:
22092284
- staticcheck
22102285
- structcheck
22112286
- stylecheck
2287+
- tagalign
22122288
- tagliatelle
22132289
- tenv
22142290
- testableexamples

.golangci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ linters-settings:
1010
dupl:
1111
threshold: 100
1212
funlen:
13-
lines: 100
13+
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
1414
statements: 50
1515
goconst:
1616
min-len: 2
@@ -63,6 +63,10 @@ linters-settings:
6363
allow-unused: false # report any unused nolint directives
6464
require-explanation: false # don't require an explanation for nolint directives
6565
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
66+
revive:
67+
rules:
68+
- name: unexported-return
69+
disabled: true
6670

6771
linters:
6872
disable-all: true
@@ -91,6 +95,7 @@ linters:
9195
- nakedret
9296
- noctx
9397
- nolintlint
98+
- revive
9499
- staticcheck
95100
- stylecheck
96101
- typecheck
@@ -112,7 +117,6 @@ linters:
112117
# - nestif
113118
# - prealloc
114119
# - testpackage
115-
# - revive
116120
# - wsl
117121

118122
issues:

.pre-commit-hooks.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
- id: golangci-lint
22
name: golangci-lint
33
description: Fast linters runner for Go.
4-
entry: golangci-lint run --fix
4+
entry: golangci-lint run --new-from-rev HEAD --fix
55
types: [go]
66
language: golang
7+
require_serial: true
78
pass_filenames: false

0 commit comments

Comments
 (0)