fix: resolve golangci-lint errcheck warnings
- Add error checks for unchecked return values (errcheck) - Remove unused struct fields (unused) - Fix gofmt formatting issues
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -22,7 +21,6 @@ type Server struct {
|
||||
readyPath string
|
||||
readyCheck ReadyFunc
|
||||
srv *http.Server
|
||||
ready atomic.Bool
|
||||
}
|
||||
|
||||
// New creates a health server on the given port.
|
||||
|
||||
@@ -19,7 +19,7 @@ func TestHealthEndpoint(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("health request failed: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("expected 200, got %d", resp.StatusCode)
|
||||
@@ -42,7 +42,7 @@ func TestReadyEndpointDefault(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ready request failed: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("expected 200, got %d", resp.StatusCode)
|
||||
@@ -60,7 +60,7 @@ func TestReadyEndpointNotReady(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ready request failed: %v", err)
|
||||
}
|
||||
resp.Body.Close()
|
||||
_ = resp.Body.Close()
|
||||
if resp.StatusCode != 503 {
|
||||
t.Errorf("expected 503 when not ready, got %d", resp.StatusCode)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func TestReadyEndpointNotReady(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ready request failed: %v", err)
|
||||
}
|
||||
resp2.Body.Close()
|
||||
_ = resp2.Body.Close()
|
||||
if resp2.StatusCode != 200 {
|
||||
t.Errorf("expected 200 when ready, got %d", resp2.StatusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user