mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
chore: Update golangci lint to 2.0.x (#572)
* Update to golangci lint 2.0.x Signed-off-by: James Hillyerd <james@hillyerd.com> * Fix new lint warnings Signed-off-by: James Hillyerd <james@hillyerd.com> --------- Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -12,6 +12,6 @@ jobs:
|
||||
with:
|
||||
go-version: '1.24'
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: latest
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
run:
|
||||
timeout: 5m
|
||||
version: "2"
|
||||
linters:
|
||||
enable:
|
||||
- asasalint
|
||||
@@ -10,29 +9,17 @@ linters:
|
||||
- contextcheck
|
||||
- copyloopvar
|
||||
- decorder
|
||||
# - dupl
|
||||
# - dupword
|
||||
- durationcheck
|
||||
- errchkjson
|
||||
- errname
|
||||
# - errorlint
|
||||
# - exhaustive
|
||||
# - forcetypeassert
|
||||
- ginkgolinter
|
||||
- gocheckcompilerdirectives
|
||||
# - gochecknoinits
|
||||
- gochecksumtype
|
||||
- gocritic
|
||||
# - godot
|
||||
# - goerr113
|
||||
- gofmt
|
||||
# - gofumpt
|
||||
- goheader
|
||||
- goimports
|
||||
- gomoddirectives
|
||||
- gomodguard
|
||||
- goprintffuncname
|
||||
# - gosec
|
||||
- gosmopolitan
|
||||
- grouper
|
||||
- importas
|
||||
@@ -44,8 +31,6 @@ linters:
|
||||
- misspell
|
||||
- musttag
|
||||
- nilerr
|
||||
# - nilnil
|
||||
# - nlreturn
|
||||
- noctx
|
||||
- nolintlint
|
||||
- nosprintfhostport
|
||||
@@ -55,24 +40,43 @@ linters:
|
||||
- promlinter
|
||||
- protogetter
|
||||
- reassign
|
||||
# - revive
|
||||
- rowserrcheck
|
||||
- sloglint
|
||||
- stylecheck
|
||||
- staticcheck
|
||||
- tagliatelle
|
||||
- testableexamples
|
||||
- testifylint
|
||||
- thelper
|
||||
- tparallel
|
||||
# - unconvert
|
||||
- unparam
|
||||
- usestdlibvars
|
||||
- usetesting
|
||||
- wastedassign
|
||||
- whitespace
|
||||
- zerologlint
|
||||
linters-settings:
|
||||
tagliatelle:
|
||||
case:
|
||||
rules:
|
||||
json: kebab
|
||||
settings:
|
||||
tagliatelle:
|
||||
case:
|
||||
rules:
|
||||
json: kebab
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
||||
@@ -214,7 +214,7 @@ func (s *Session) authorizationHandler(cmd string, args []string) {
|
||||
s.enterState(QUIT)
|
||||
|
||||
case "STLS":
|
||||
if !s.Server.config.TLSEnabled || s.Server.config.ForceTLS {
|
||||
if !s.config.TLSEnabled || s.config.ForceTLS {
|
||||
// Invalid command since TLS unconfigured.
|
||||
s.logger.Debug().Msgf("-ERR TLS unavailable on the server")
|
||||
s.send("-ERR TLS unavailable on the server")
|
||||
@@ -230,7 +230,7 @@ func (s *Session) authorizationHandler(cmd string, args []string) {
|
||||
|
||||
// Start TLS connection handshake.
|
||||
s.send("+OK Begin TLS Negotiation")
|
||||
tlsConn := tls.Server(s.conn, s.Server.tlsConfig)
|
||||
tlsConn := tls.Server(s.conn, s.tlsConfig)
|
||||
if err := tlsConn.Handshake(); err != nil {
|
||||
s.logger.Error().Msgf("-ERR TLS handshake failed %v", err)
|
||||
s.ooSeq(cmd)
|
||||
|
||||
@@ -300,7 +300,7 @@ func (s *Session) greetHandler(cmd string, arg string) {
|
||||
s.send("250-" + readyBanner)
|
||||
s.send("250-8BITMIME")
|
||||
s.send("250-AUTH PLAIN LOGIN")
|
||||
if s.Server.config.TLSEnabled && !s.Server.config.ForceTLS && s.Server.tlsConfig != nil && s.tlsState == nil {
|
||||
if s.config.TLSEnabled && !s.config.ForceTLS && s.tlsConfig != nil && s.tlsState == nil {
|
||||
s.send("250-STARTTLS")
|
||||
}
|
||||
s.send(fmt.Sprintf("250 SIZE %v", s.config.MaxMessageBytes))
|
||||
@@ -338,7 +338,7 @@ func (s *Session) passwordHandler() {
|
||||
func (s *Session) readyHandler(cmd string, arg string) {
|
||||
switch cmd {
|
||||
case "STARTTLS":
|
||||
if !s.Server.config.TLSEnabled {
|
||||
if !s.config.TLSEnabled {
|
||||
// Invalid command since TLS unconfigured.
|
||||
s.logger.Debug().Msgf("454 TLS unavailable on the server")
|
||||
s.send("454 TLS unavailable on the server")
|
||||
@@ -354,7 +354,7 @@ func (s *Session) readyHandler(cmd string, arg string) {
|
||||
|
||||
// Start TLS connection handshake.
|
||||
s.send("220 STARTTLS")
|
||||
tlsConn := tls.Server(s.conn, s.Server.tlsConfig)
|
||||
tlsConn := tls.Server(s.conn, s.tlsConfig)
|
||||
s.conn = tlsConn
|
||||
s.text = textproto.NewConn(s.conn)
|
||||
s.tlsState = new(tls.ConnectionState)
|
||||
|
||||
@@ -70,7 +70,7 @@ func (m *ManagerStub) MarkSeen(mailbox, id string) error {
|
||||
}
|
||||
for _, msg := range m.mailboxes[mailbox] {
|
||||
if msg.ID == id {
|
||||
msg.MessageMetadata.Seen = true
|
||||
msg.Seen = true
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ func testPurge(s storeSuite) {
|
||||
}
|
||||
gotEvents = append(gotEvents, ev)
|
||||
}
|
||||
assert.Equal(s, len(subjects), len(gotEvents),
|
||||
assert.Len(s, gotEvents, len(subjects),
|
||||
"expected delete event for each message in mailbox")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user