Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies #26

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -58,7 +58,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -71,6 +71,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.22

- name: Build
run: go build -v ./...
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ integration:
go run github.com/d--j/go-milter/integration/runner -filter '.*' -mtaFilter '.*' ./tests

.PHONY: integration

integration-only-mock:
cd integration && go run github.com/d--j/go-milter/integration/runner -filter '.*' -mtaFilter 'mock' ./tests

.PHONY: only-mock
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ module github.com/d--j/go-milter
go 1.18

require (
github.com/emersion/go-message v0.17.0
golang.org/x/net v0.23.0
golang.org/x/text v0.14.0
github.com/emersion/go-message v0.18.1
golang.org/x/net v0.34.0
golang.org/x/text v0.21.0
)

require github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 // indirect
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/emersion/go-message v0.17.0 h1:NIdSKHiVUx4qKqdd0HyJFD41cW8iFguM2XJnRZWQH04=
github.com/emersion/go-message v0.17.0/go.mod h1:/9Bazlb1jwUNB0npYYBsdJ2EMOiiyN3m5UVHbY7GoNw=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/emersion/go-message v0.18.1 h1:tfTxIoXFSFRwWaZsgnqS1DSZuGpYGzSmCZD8SK3QA2E=
github.com/emersion/go-message v0.18.1/go.mod h1:XpJyL70LwRvq2a8rVbHXikPgKj8+aI0kGdHlg16ibYA=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand All @@ -11,8 +9,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -29,9 +27,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down
19 changes: 9 additions & 10 deletions integration/go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
module github.com/d--j/go-milter/integration

go 1.18
go 1.22.0

toolchain go1.23.4

require (
github.com/d--j/go-milter v0.8.4
github.com/emersion/go-message v0.17.0
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43
github.com/emersion/go-smtp v0.20.0
golang.org/x/text v0.14.0
golang.org/x/tools v0.16.1
github.com/emersion/go-message v0.18.1
github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6
github.com/emersion/go-smtp v0.21.3
golang.org/x/text v0.21.0
golang.org/x/tools v0.29.0
)

require (
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 // indirect
golang.org/x/net v0.23.0 // indirect
)
require golang.org/x/net v0.34.0 // indirect

replace github.com/d--j/go-milter => ../
31 changes: 16 additions & 15 deletions integration/go.sum
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
github.com/emersion/go-message v0.17.0 h1:NIdSKHiVUx4qKqdd0HyJFD41cW8iFguM2XJnRZWQH04=
github.com/emersion/go-message v0.17.0/go.mod h1:/9Bazlb1jwUNB0npYYBsdJ2EMOiiyN3m5UVHbY7GoNw=
github.com/emersion/go-message v0.18.1 h1:tfTxIoXFSFRwWaZsgnqS1DSZuGpYGzSmCZD8SK3QA2E=
github.com/emersion/go-message v0.18.1/go.mod h1:XpJyL70LwRvq2a8rVbHXikPgKj8+aI0kGdHlg16ibYA=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 h1:hH4PQfOndHDlpzYfLAAfl63E8Le6F2+EL/cdhlkyRJY=
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-smtp v0.20.0 h1:eTD2iPzYKRrFF+NDHPwKgsBt5ZmB2jO6P2rP2LlVYWI=
github.com/emersion/go-smtp v0.20.0/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6 h1:oP4q0fw+fOSWn3DfFi4EXdT+B+gTtzx8GC9xsc26Znk=
github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-smtp v0.21.3 h1:7uVwagE8iPYE48WhNsng3RRpCUpFvNl39JGNSIyGVMY=
github.com/emersion/go-smtp v0.21.3/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -35,13 +36,13 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
49 changes: 28 additions & 21 deletions integration/mta/mock/mta.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
"log"
"math/rand"
"net"
textproto2 "net/textproto"
"net/textproto"
"strconv"
"strings"
"time"

"github.com/d--j/go-milter"
"github.com/emersion/go-sasl"
"github.com/emersion/go-smtp"
)

Expand Down Expand Up @@ -128,21 +129,27 @@ type Session struct {
QuarantineReason *string
}

func (s *Session) AuthPlain(username, password string) error {
found := false
if username == "user1@example.com" && password == "password1" {
found = true
}
if username == "user2@example.com" && password == "password2" {
found = true
}
if found {
s.macros.Set(milter.MacroAuthType, "plain")
s.macros.Set(milter.MacroAuthAuthen, username)
log.Printf("[%s] Authenticated as: %s", s.queueId, username)
return nil
}
return errors.New("invalid username or password")
func (s *Session) AuthMechanisms() []string {
return []string{sasl.Plain}
}

func (s *Session) Auth(_ string) (sasl.Server, error) {
return sasl.NewPlainServer(func(identity, username, password string) error {
found := false
if username == "user1@example.com" && password == "password1" {
found = true
}
if username == "user2@example.com" && password == "password2" {
found = true
}
if found {
s.macros.Set(milter.MacroAuthType, "plain")
s.macros.Set(milter.MacroAuthAuthen, username)
log.Printf("[%s] Authenticated as: %s", s.queueId, username)
return nil
}
return errors.New("invalid username or password")
}), nil
}

func (s *Session) handleMilter(resp *milter.Action, err error) error {
Expand Down Expand Up @@ -247,7 +254,7 @@ func (s *Session) Mail(from string, opts *smtp.MailOptions) error {
return s.handleMilter(s.filter.Mail(s.MailFrom, s.MailFromArgs))
}

func (s *Session) Rcpt(to string, opts *smtp.RcptOptions) error {
func (s *Session) Rcpt(to string, _ *smtp.RcptOptions) error {
log.Printf("[%s] Rcpt to: %s", s.queueId, to)
if s.discarded {
return nil
Expand Down Expand Up @@ -350,7 +357,7 @@ func (s *Session) Data(r io.Reader) error {
}
raw := fmt.Sprintf("%s:%s%s\r\n", act.HeaderName, maybeSpace, act.HeaderValue)
headers = append(headers, &field{
key: textproto2.CanonicalMIMEHeaderKey(act.HeaderName),
key: textproto.CanonicalMIMEHeaderKey(act.HeaderName),
changeIdx: -1,
raw: []byte(raw),
})
Expand All @@ -362,7 +369,7 @@ func (s *Session) Data(r io.Reader) error {
}
raw := fmt.Sprintf("%s:%s%s\r\n", act.HeaderName, maybeSpace, act.HeaderValue)
f := &field{
key: textproto2.CanonicalMIMEHeaderKey(act.HeaderName),
key: textproto.CanonicalMIMEHeaderKey(act.HeaderName),
changeIdx: -1,
raw: []byte(raw),
}
Expand All @@ -383,7 +390,7 @@ func (s *Session) Data(r io.Reader) error {
maybeSpace = " "
}
raw := fmt.Sprintf("%s:%s%s\r\n", act.HeaderName, maybeSpace, act.HeaderValue)
key := textproto2.CanonicalMIMEHeaderKey(act.HeaderName)
key := textproto.CanonicalMIMEHeaderKey(act.HeaderName)
for _, f := range headers {
if f.key == key && f.changeIdx == int(act.HeaderIndex) {
if act.HeaderValue == "" {
Expand Down Expand Up @@ -470,7 +477,7 @@ func splitHeaders(headerBytes []byte) (fields []*field) {
log.Print(s)
panic("key not found")
}
key := textproto2.CanonicalMIMEHeaderKey(strings.TrimSpace(s[0][:keyIdx]))
key := textproto.CanonicalMIMEHeaderKey(strings.TrimSpace(s[0][:keyIdx]))
keyCounter[key] += 1
fields = append(fields, &field{
key: key,
Expand Down
9 changes: 4 additions & 5 deletions integration/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func ParseConfig() *Config {
mtaFilter := ""
flag.StringVar(&mtaFilter, "mtaFilter", "", "regexp `pattern` to filter MTAs")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
_, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
fmt.Fprintf(flag.CommandLine.Output(), " test-dir...\n \tone ore more directories containing test filters and testcases\n")
_, _ = fmt.Fprintf(flag.CommandLine.Output(), " test-dir...\n \tone ore more directories containing test filters and testcases\n")
}
flag.Parse()
if filter == "" {
Expand Down Expand Up @@ -228,7 +228,8 @@ func expandTestDirs(in []string) (dirs []string, err error) {
}
pkg, err := ctxt.ImportDir(candidate, 0)
if err != nil {
if _, ok := err.(*build.NoGoError); ok {
var noGoError *build.NoGoError
if errors.As(err, &noGoError) {
err = filepath.WalkDir(candidate, func(path string, d fs.DirEntry, err error) error {
if err == nil && candidate != path && d.IsDir() {
in = append(in, path)
Expand All @@ -241,8 +242,6 @@ func expandTestDirs(in []string) (dirs []string, err error) {
if err != nil {
return nil, err
}
} else {
return nil, err
}
} else {
if !pkg.IsCommand() {
Expand Down
6 changes: 4 additions & 2 deletions integration/runner/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"fmt"
"log"
"net"
Expand Down Expand Up @@ -31,7 +32,7 @@ func WaitForPort(ctx context.Context, port uint16) error {
time.Sleep(250 * time.Millisecond)
conn, err := net.Dial("tcp", fmt.Sprintf(":%d", port))
if err == nil {
conn.Close()
_ = conn.Close()
return nil
}
}
Expand All @@ -42,7 +43,8 @@ func IsExpectedExitErr(err error) bool {
if err == nil {
return true
}
if e, ok := err.(*exec.ExitError); ok {
var e *exec.ExitError
if errors.As(err, &e) {
if e.Success() || e.ExitCode() == integration.ExitSkip {
return true
}
Expand Down
1 change: 1 addition & 0 deletions integration/runner/mta.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (m *MTA) Start() error {
if err != nil {
return err
}
//goland:noinspection GoDeferInLoop
defer func(d time.Duration) { time.Sleep(d) }(d)
break
}
Expand Down
9 changes: 7 additions & 2 deletions integration/runner/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/d--j/go-milter/integration"
"github.com/emersion/go-sasl"
"github.com/emersion/go-smtp"
)

Expand Down Expand Up @@ -41,8 +42,12 @@ func (rs *ReceiverSession) Logout() error {
return nil
}

func (rs *ReceiverSession) AuthPlain(_, _ string) error {
return errors.New("no auth")
func (rs *ReceiverSession) AuthMechanisms() []string {
return []string{}
}

func (rs *ReceiverSession) Auth(_ string) (sasl.Server, error) {
return nil, errors.New("no auth")
}

func (rs *ReceiverSession) Mail(from string, opts *smtp.MailOptions) error {
Expand Down
Loading
Loading