Skip to content

Commit 474c059

Browse files
committed
fix: improve test command and enhance message channel buffer size
1 parent 3ea0cd1 commit 474c059

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

.github/workflows/commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- run: go mod verify
3939

40-
- run: go test -v ./...
40+
- run: go test -race -shuffle=on -count=1 -v ./...
4141

4242
- uses: golangci/golangci-lint-action@v9
4343
with:

cmd/cname.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ func publishing(ctx context.Context, publisher *avahi.Publisher, cnames []string
5353
}
5454
case <-ctx.Done():
5555
fmt.Println() // Add new line after ^C
56-
slog.Info("closing publisher")
57-
publisher.Close()
5856
return nil
5957
}
6058
}
@@ -124,6 +122,7 @@ func Cname(ctx context.Context) *cli.Command {
124122
if err != nil {
125123
return fmt.Errorf("failed to create publisher: %w", err)
126124
}
125+
defer publisher.Close()
127126

128127
if fqdn == "" {
129128
slog.Info("getting FQDN from Avahi")

cmd/subdomain_listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func listen() (*net.UDPConn, *ipv4.PacketConn, error) {
9494

9595
func reader(ctx context.Context, conn *net.UDPConn) <-chan *dnsMsg {
9696
buf := make([]byte, 1500)
97-
msgCh := make(chan *dnsMsg)
97+
msgCh := make(chan *dnsMsg, 1)
9898

9999
go func() {
100100
defer close(msgCh)

0 commit comments

Comments
 (0)