File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ jobs:
2929 box-version : ' 4'
3030
3131 go :
32- uses : typisttech/.github/.github/workflows/lint-go.yml@3b989be3639ac84acd7770ad0795ffbfc6193b2b # v5.2.2
32+ uses : typisttech/.github/.github/workflows/lint-go.yml@86c07906e5ad8ccd4bab27975f7f67e348498f82 # v5.4.0
3333 with :
3434 golangci-lint : true
35- golangci-lint-version : v2.11 # Must be kept in sync with @../../mise.toml
35+ golangci-lint-version-file : .tool-versions
3636
3737 wait-for-all-lint :
3838 if : cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure')
Original file line number Diff line number Diff line change 1+ version : " 2"
2+
3+ linters :
4+ enable :
5+ # Default
6+ - errcheck
7+ - govet
8+ - ineffassign
9+ - staticcheck
10+ - unused
11+ # Custom
12+ - asasalint
13+ - asciicheck
14+ - bidichk
15+ - bodyclose
16+ - containedctx
17+ - contextcheck
18+ - copyloopvar
19+ - cyclop
20+ - depguard
21+ - dogsled
22+ - dupl
23+ - dupword
24+ - durationcheck
25+ - embeddedstructfieldcheck
26+ - errchkjson
27+ - errname
28+ - errorlint
29+ - exhaustive
30+ - exptostd
31+ - fatcontext
32+ - forcetypeassert
33+ - gocheckcompilerdirectives
34+ - gochecknoinits
35+ - gocritic
36+ - godoclint
37+ - godot
38+ - gosec
39+ - misspell
40+ - nolintlint
41+ - nonamedreturns
42+ - revive
43+ - sloglint
44+ - unparam
45+ - usestdlibvars
46+
47+ settings :
48+ govet :
49+ enable-all : true
50+ disable :
51+ - fieldalignment
52+
53+ staticcheck :
54+ checks :
55+ - all
56+ - -ST1000 # at least one file in a package should have a package comment
57+
58+ # Custom
59+ depguard :
60+ rules :
61+ all :
62+ list-mode : strict
63+ files :
64+ - $all
65+ - " !$test"
66+ allow :
67+ - $gostd
68+ - golang.org/x
69+ - github.com/typisttech/php-matrix
70+ - github.com/rogpeppe/go-internal/testscript
71+ test :
72+ files :
73+ - $test
74+ deny :
75+ - pkg : github.com/stretchr/testify
76+ desc : Use standard library or 'github.com/google/go-cmp/cmp'
77+
78+ errorlint :
79+ errorf : false
80+
81+ exhaustive :
82+ default-signifies-exhaustive : true
83+
84+ gocritic :
85+ enabled-checks :
86+ - emptyStringTest
87+ - preferStringWriter
88+
89+ godoclint :
90+ enable :
91+ - max-len
92+ - no-unused-link
93+ - require-stdlib-doclink
94+
95+ godot :
96+ scope : toplevel
97+ capital : true
98+
99+ gosec :
100+ excludes :
101+ - G104 # Handled by errcheck
102+
103+ nolintlint :
104+ require-specific : true
105+
106+ revive :
107+ rules :
108+ - name : exported
109+ disabled : true
110+
111+ exclusions :
112+ generated : disable
113+ warn-unused : true
114+ rules :
115+ - source : " ^\\ s*defer\\ s+"
116+ linters :
117+ - errcheck
118+
119+ - source : " ^\\ s*os\\ .Stdout\\ .WriteString\\ ("
120+ linters :
121+ - errcheck
122+
123+ formatters :
124+ enable :
125+ - gci
126+ - gofmt
127+ - gofumpt
128+ - goimports
129+
130+ settings :
131+ gofumpt :
132+ extra-rules : true
Original file line number Diff line number Diff line change 1+ golangci-lint 2.12
Original file line number Diff line number Diff line change @@ -68,8 +68,9 @@ type rawData struct {
6868}
6969
7070type data struct {
71- Mode string
7271 rawData
72+
73+ Mode string
7374}
7475
7576func (d data ) Name () string {
Original file line number Diff line number Diff line change @@ -58,8 +58,10 @@ stdout .
5858{"require":{"php":"{{ .Constraint }}"}}
5959`
6060
61- var eolFileTemplate = template .Must (template .New ("" ).Parse (eolTemplateRaw ))
62- var supportedFileTemplate = template .Must (template .New ("" ).Parse (supportedTemplateRaw ))
61+ var (
62+ eolFileTemplate = template .Must (template .New ("" ).Parse (eolTemplateRaw ))
63+ supportedFileTemplate = template .Must (template .New ("" ).Parse (supportedTemplateRaw ))
64+ )
6365
6466type data struct {
6567 Mode string
Original file line number Diff line number Diff line change @@ -56,8 +56,9 @@ type rawData struct {
5656}
5757
5858type data struct {
59- Mode string
6059 rawData
60+
61+ Mode string
6162}
6263
6364func (d data ) Name () string {
Original file line number Diff line number Diff line change @@ -53,8 +53,10 @@ stdout .
5353! stderr .
5454`
5555
56- var eolFileTemplate = template .Must (template .New ("" ).Parse (eolTemplateRaw ))
57- var supportedFileTemplate = template .Must (template .New ("" ).Parse (supportedTemplateRaw ))
56+ var (
57+ eolFileTemplate = template .Must (template .New ("" ).Parse (eolTemplateRaw ))
58+ supportedFileTemplate = template .Must (template .New ("" ).Parse (supportedTemplateRaw ))
59+ )
5860
5961type data struct {
6062 Mode string
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ func ensureDirEmpty(path string) error {
2525 return err
2626 }
2727
28- if err := os .MkdirAll (path , 0755 ); err != nil {
28+ if err := os .MkdirAll (path , 0o750 ); err != nil {
2929 return err
3030 }
3131
Original file line number Diff line number Diff line change @@ -11,28 +11,33 @@ type txtarWriter interface {
1111}
1212
1313func Generate [T txtarWriter ](name string , cases ... T ) error {
14- _ , _ = os .Stdout .Write ([] byte ( "\n ==> Generating " + name + " scripts\n \n " ) )
14+ os .Stdout .WriteString ( "\n ==> Generating " + name + " scripts\n \n " )
1515
1616 dir , err := filepath .Abs ("testdata" )
1717 if err != nil {
1818 return err
1919 }
20- _ , _ = os .Stdout .Write ([] byte ( dir + "\n " ) )
20+ os .Stdout .WriteString ( dir + "\n " )
2121
2222 if err := ensureDirEmpty (dir ); err != nil {
2323 return err
2424 }
2525
2626 for _ , w := range cases {
2727 n := sanitizeFilename (w .Name ()) + ".txtar"
28- _ , _ = os .Stdout .Write ([] byte ( " - " + n + "\n " ) )
28+ os .Stdout .WriteString ( " - " + n + "\n " )
2929
30- p := filepath .Join (dir , n )
31- f , err := os .Create (p )
30+ r , err := os .OpenRoot (dir )
3231 if err != nil {
3332 return err
3433 }
35- defer func () { _ = f .Close () }()
34+ defer r .Close ()
35+
36+ f , err := r .Create (n )
37+ if err != nil {
38+ return err
39+ }
40+ defer f .Close ()
3641
3742 err = w .Write (f )
3843 if err != nil {
Original file line number Diff line number Diff line change 1- [tools ]
2- # Must be kept in sync with GitHub Actions workflow @.github/workflows/lint.yml
3- golangci-lint = ' 2.11'
4-
51[env ]
62GOFLAGS = ' -mod=mod'
73
@@ -42,4 +38,4 @@ run = '{{ config_root }}/bin/generate-test-data'
4238
4339[tasks .'txtar' ]
4440depends = [' gen' ]
45- run = [' go generate ./...' , ' UPDATE_SCRIPTS=0 mise run test:bin' ]
41+ run = [' go generate ./...' , ' UPDATE_SCRIPTS=1 mise run test:bin' ]
You can’t perform that action at this time.
0 commit comments