File tree Expand file tree Collapse file tree 4 files changed +35
-5
lines changed Expand file tree Collapse file tree 4 files changed +35
-5
lines changed Original file line number Diff line number Diff line change 1212 - watchtowerrpc
1313
1414linters-settings :
15+
1516 govet :
1617 # Don't report about shadowed variables
1718 check-shadowing : false
19+
1820 gofmt :
1921 # simplify code: gofmt with `-s` option, true by default
2022 simplify : true
23+
2124 funlen :
2225 # Checks the number of lines in a function.
2326 # If lower than 0, disable the check.
2427 lines : 200
2528 # Checks the number of statements in a function.
2629 statements : 80
30+
2731 gosec :
2832 excludes :
2933 - G402 # Look for bad TLS connection settings.
3034 - G306 # Poor file permissions used when writing to a new file.
3135
36+ whitespace :
37+ multi-func : true
38+ multi-if : true
39+
3240linters :
3341 enable-all : true
3442 disable :
43+ # Allow dynamic errors.
44+ - goerr113
45+
46+ # We want to allow short variable names.
47+ - varnamelen
48+
3549 # Init functions are used by loggers throughout the codebase.
3650 - gochecknoinits
3751
@@ -46,6 +60,17 @@ linters:
4660 # instances are created.
4761 - exhaustruct
4862
63+ # Disable gofumpt as it has weird behavior regarding formatting multiple
64+ # lines for a function which is in conflict with our contribution
65+ # guidelines. See https://github.com/mvdan/gofumpt/issues/235.
66+ - gofumpt
67+
68+ # Disable whitespace linter as it has conflict rules against our
69+ # contribution guidelines. See https://github.com/bombsimon/wsl/issues/109.
70+ #
71+ # TODO: bring it back when the above issue is fixed.
72+ - wsl
73+
4974 # Deprecated linters. See https://golangci-lint.run/usage/linters/.
5075 - interfacer
5176 - golint
Original file line number Diff line number Diff line change @@ -96,7 +96,10 @@ func (g *GoBackNConn) clientHandshake() error {
9696 }
9797 }()
9898
99- var resp Message
99+ var (
100+ resp Message
101+ respSYN * PacketSYN
102+ )
100103handshake:
101104 for {
102105 // start Handshake
@@ -148,8 +151,10 @@ handshake:
148151
149152 g .log .Debugf ("Got %T" , resp )
150153
151- switch resp .(type ) {
154+ switch r := resp .(type ) {
152155 case * PacketSYN :
156+ respSYN = r
157+
153158 break handshake
154159 default :
155160 }
@@ -162,7 +167,7 @@ handshake:
162167
163168 g .log .Debugf ("Got SYN" )
164169
165- if resp .( * PacketSYN ) .N != g .cfg .n {
170+ if respSYN .N != g .cfg .n {
166171 return io .EOF
167172 }
168173
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ type GoBackNConn struct {
6767 // remoteClosed is closed if the remote party initiated the FIN sequence.
6868 remoteClosed chan struct {}
6969
70- ctx context.Context
70+ ctx context.Context //nolint:containedctx
7171 cancel func ()
7272
7373 // quit is used to stop the normal operations of the connection.
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ type Server struct {
2626
2727 sid [64 ]byte
2828
29- ctx context.Context
29+ ctx context.Context //nolint:containedctx
3030
3131 quit chan struct {}
3232 cancel func ()
You can’t perform that action at this time.
0 commit comments