Skip to content

Commit bcaca21

Browse files
committed
Fix linter errors for unchecked return values
1 parent 94a72a6 commit bcaca21

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- main
1212

1313
env:
14-
GOLANGCI_LINT_VERSION: v1.61.0
14+
GOLANGCI_LINT_VERSION: v2.2.1
1515

1616
jobs:
1717
lint:
@@ -34,7 +34,7 @@ jobs:
3434
run: go mod tidy && git diff --exit-code
3535

3636
- name: golangci-lint
37-
uses: golangci/golangci-lint-action@v3
37+
uses: golangci/golangci-lint-action@v8
3838
with:
3939
version: ${{ env.GOLANGCI_LINT_VERSION }}
4040
skip-cache: true # cache/restore is done by actions/setup-go@v3 step

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := build
22
LINT = $(GOPATH)/bin/golangci-lint
3-
LINT_VERSION = v1.64.6
3+
LINT_VERSION = v2.2.1
44
VERSION=$(shell git describe --tags --exact-match 2>/dev/null || echo "dev-build")
55

66
.PHONY: install

daemon/daemon.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ func (d *Daemon) Client() (*querator.Client, error) {
131131
// Serve the server side of the pipe through the InMemoryListener
132132
if inMemListener, ok := d.Listener.(*InMemoryListener); ok {
133133
if err := inMemListener.ServeConn(serverConn); err != nil {
134-
clientConn.Close()
135-
serverConn.Close()
134+
_ = clientConn.Close()
135+
_ = serverConn.Close()
136136
return nil, fmt.Errorf("failed to serve connection: %w", err)
137137
}
138138
} else {
139-
clientConn.Close()
140-
serverConn.Close()
139+
_ = clientConn.Close()
140+
_ = serverConn.Close()
141141
return nil, fmt.Errorf("InMemoryListener is enabled but listener is not of type *InMemoryListener")
142142
}
143143

daemon/listener_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ func TestInMemoryListener(t *testing.T) {
2020
listener := daemon.NewInMemoryListener()
2121
server := &http.Server{
2222
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
23-
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
23+
_, _ = fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
2424
}),
2525
}
26-
go server.Serve(listener)
27-
defer server.Close()
26+
go func() { _ = server.Serve(listener) }()
27+
defer func() { _ = server.Close() }()
2828

2929
clientCount := 3
3030
var wg sync.WaitGroup
@@ -34,7 +34,7 @@ func TestInMemoryListener(t *testing.T) {
3434
defer wg.Done()
3535
// Each client gets its own net.Pipe
3636
serverConn, clientConn := net.Pipe()
37-
listener.ServeConn(serverConn)
37+
_ = listener.ServeConn(serverConn)
3838

3939
// Custom DialContext returns the clientConn for this request
4040
dialOnce := sync.Once{}
@@ -56,7 +56,7 @@ func TestInMemoryListener(t *testing.T) {
5656
t.Errorf("client %d error: %v", id, err)
5757
return
5858
}
59-
defer resp.Body.Close()
59+
defer func() { _ = resp.Body.Close() }()
6060
body, _ := io.ReadAll(resp.Body)
6161
expected := fmt.Sprintf("Hello, client%d!", id)
6262
if !strings.Contains(string(body), expected) {
@@ -65,7 +65,7 @@ func TestInMemoryListener(t *testing.T) {
6565
}(i)
6666
}
6767
wg.Wait()
68-
listener.Close()
68+
_ = listener.Close()
6969
}
7070

7171
func TestDaemonInMemoryListener(t *testing.T) {
@@ -76,7 +76,7 @@ func TestDaemonInMemoryListener(t *testing.T) {
7676
InMemoryListener: true,
7777
})
7878
require.NoError(t, err)
79-
defer d.Shutdown(ctx)
79+
defer func() { _ = d.Shutdown(ctx) }()
8080

8181
// Get a client - should create a new net.Pipe connection
8282
{

0 commit comments

Comments
 (0)