1
0
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:
James Hillyerd
2025-05-08 21:23:42 -07:00
committed by GitHub
parent 9a2b0f934a
commit cf92969719
6 changed files with 36 additions and 32 deletions

View File

@@ -12,6 +12,6 @@ jobs:
with: with:
go-version: '1.24' go-version: '1.24'
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v7
with: with:
version: latest version: latest

View File

@@ -1,5 +1,4 @@
run: version: "2"
timeout: 5m
linters: linters:
enable: enable:
- asasalint - asasalint
@@ -10,29 +9,17 @@ linters:
- contextcheck - contextcheck
- copyloopvar - copyloopvar
- decorder - decorder
# - dupl
# - dupword
- durationcheck - durationcheck
- errchkjson - errchkjson
- errname - errname
# - errorlint
# - exhaustive
# - forcetypeassert
- ginkgolinter - ginkgolinter
- gocheckcompilerdirectives - gocheckcompilerdirectives
# - gochecknoinits
- gochecksumtype - gochecksumtype
- gocritic - gocritic
# - godot
# - goerr113
- gofmt
# - gofumpt
- goheader - goheader
- goimports
- gomoddirectives - gomoddirectives
- gomodguard - gomodguard
- goprintffuncname - goprintffuncname
# - gosec
- gosmopolitan - gosmopolitan
- grouper - grouper
- importas - importas
@@ -44,8 +31,6 @@ linters:
- misspell - misspell
- musttag - musttag
- nilerr - nilerr
# - nilnil
# - nlreturn
- noctx - noctx
- nolintlint - nolintlint
- nosprintfhostport - nosprintfhostport
@@ -55,24 +40,43 @@ linters:
- promlinter - promlinter
- protogetter - protogetter
- reassign - reassign
# - revive
- rowserrcheck - rowserrcheck
- sloglint - sloglint
- stylecheck - staticcheck
- tagliatelle - tagliatelle
- testableexamples - testableexamples
- testifylint - testifylint
- thelper - thelper
- tparallel - tparallel
# - unconvert
- unparam - unparam
- usestdlibvars - usestdlibvars
- usetesting - usetesting
- wastedassign - wastedassign
- whitespace - whitespace
- zerologlint - zerologlint
linters-settings: settings:
tagliatelle: tagliatelle:
case: case:
rules: rules:
json: kebab 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$

View File

@@ -214,7 +214,7 @@ func (s *Session) authorizationHandler(cmd string, args []string) {
s.enterState(QUIT) s.enterState(QUIT)
case "STLS": case "STLS":
if !s.Server.config.TLSEnabled || s.Server.config.ForceTLS { if !s.config.TLSEnabled || s.config.ForceTLS {
// Invalid command since TLS unconfigured. // Invalid command since TLS unconfigured.
s.logger.Debug().Msgf("-ERR TLS unavailable on the server") s.logger.Debug().Msgf("-ERR TLS unavailable on the server")
s.send("-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. // Start TLS connection handshake.
s.send("+OK Begin TLS Negotiation") 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 { if err := tlsConn.Handshake(); err != nil {
s.logger.Error().Msgf("-ERR TLS handshake failed %v", err) s.logger.Error().Msgf("-ERR TLS handshake failed %v", err)
s.ooSeq(cmd) s.ooSeq(cmd)

View File

@@ -300,7 +300,7 @@ func (s *Session) greetHandler(cmd string, arg string) {
s.send("250-" + readyBanner) s.send("250-" + readyBanner)
s.send("250-8BITMIME") s.send("250-8BITMIME")
s.send("250-AUTH PLAIN LOGIN") 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("250-STARTTLS")
} }
s.send(fmt.Sprintf("250 SIZE %v", s.config.MaxMessageBytes)) 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) { func (s *Session) readyHandler(cmd string, arg string) {
switch cmd { switch cmd {
case "STARTTLS": case "STARTTLS":
if !s.Server.config.TLSEnabled { if !s.config.TLSEnabled {
// Invalid command since TLS unconfigured. // Invalid command since TLS unconfigured.
s.logger.Debug().Msgf("454 TLS unavailable on the server") s.logger.Debug().Msgf("454 TLS unavailable on the server")
s.send("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. // Start TLS connection handshake.
s.send("220 STARTTLS") s.send("220 STARTTLS")
tlsConn := tls.Server(s.conn, s.Server.tlsConfig) tlsConn := tls.Server(s.conn, s.tlsConfig)
s.conn = tlsConn s.conn = tlsConn
s.text = textproto.NewConn(s.conn) s.text = textproto.NewConn(s.conn)
s.tlsState = new(tls.ConnectionState) s.tlsState = new(tls.ConnectionState)

View File

@@ -70,7 +70,7 @@ func (m *ManagerStub) MarkSeen(mailbox, id string) error {
} }
for _, msg := range m.mailboxes[mailbox] { for _, msg := range m.mailboxes[mailbox] {
if msg.ID == id { if msg.ID == id {
msg.MessageMetadata.Seen = true msg.Seen = true
return nil return nil
} }
} }

View File

@@ -379,7 +379,7 @@ func testPurge(s storeSuite) {
} }
gotEvents = append(gotEvents, ev) 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") "expected delete event for each message in mailbox")
} }