Fix all golangci-lint warnings
- errorlint: use errors.Is for db.ErrNotFound comparisons in accountservice.go, credentialservice.go, tokenservice.go - gofmt/goimports: move mciasv1 alias into internal import group in auth.go, credentialservice.go, grpcserver.go, grpcserver_test.go - gosec G115: add nolint annotation on int32 port conversions in mciasgrpcctl/main.go and credentialservice.go (port validated as [1,65535] on input; overflow not reachable) - govet fieldalignment: reorder Server, grpcRateLimiter, grpcRateLimitEntry, testEnv structs to reduce GC bitmap size (96 -> 80 pointer bytes each) - ineffassign: remove intermediate grpcSrv = GRPCServer() call in cmd/mciassrv/main.go (immediately overwritten by TLS build) - staticcheck SA9003: replace empty if-body with _ = Serve(lis) in grpcserver_test.go 0 golangci-lint issues; 137 tests pass (go test -race ./...)
This commit is contained in:
@@ -22,12 +22,12 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/grpc/test/bufconn"
|
||||
|
||||
mciasv1 "git.wntrmute.dev/kyle/mcias/gen/mcias/v1"
|
||||
"git.wntrmute.dev/kyle/mcias/internal/auth"
|
||||
"git.wntrmute.dev/kyle/mcias/internal/config"
|
||||
"git.wntrmute.dev/kyle/mcias/internal/db"
|
||||
"git.wntrmute.dev/kyle/mcias/internal/model"
|
||||
"git.wntrmute.dev/kyle/mcias/internal/token"
|
||||
mciasv1 "git.wntrmute.dev/kyle/mcias/gen/mcias/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -38,11 +38,11 @@ const (
|
||||
// testEnv holds all resources for a single test's gRPC server.
|
||||
type testEnv struct {
|
||||
db *db.DB
|
||||
cfg *config.Config
|
||||
conn *grpc.ClientConn
|
||||
priv ed25519.PrivateKey
|
||||
pub ed25519.PublicKey
|
||||
masterKey []byte
|
||||
cfg *config.Config
|
||||
conn *grpc.ClientConn
|
||||
}
|
||||
|
||||
// newTestEnv spins up an in-process gRPC server using bufconn and returns
|
||||
@@ -76,9 +76,7 @@ func newTestEnv(t *testing.T) *testEnv {
|
||||
|
||||
lis := bufconn.Listen(bufConnSize)
|
||||
go func() {
|
||||
if err := grpcSrv.Serve(lis); err != nil {
|
||||
// Serve returns when the listener is closed; ignore that error.
|
||||
}
|
||||
_ = grpcSrv.Serve(lis) // returns on listener close; error ignored
|
||||
}()
|
||||
|
||||
conn, err := grpc.NewClient(
|
||||
|
||||
Reference in New Issue
Block a user