fix: resolve golangci-lint failures and .gitignore scope issue
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- cmd/server/main.go: acknowledge w.Write return value (errcheck)
- internal/store/mongo.go: use errors.Is for ErrNoDocuments (errorlint)
- .golangci.yml: add linter config scoped to relevant linters
- .gitignore: scope /server to root only (was blocking cmd/server/ directory)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Head of Product & Engineering 2026-04-05 21:22:03 +02:00
parent 2e07374681
commit 675f765cc0
4 changed files with 30 additions and 4 deletions

4
.gitignore vendored
View File

@ -2,5 +2,5 @@
cast-ghl-provider
/tmp/
# compiled binary (root)
server
# compiled binary (root-level only, not cmd/server/ directory)
/server

25
.golangci.yml Normal file
View File

@ -0,0 +1,25 @@
linters:
enable:
- errcheck
- govet
- staticcheck
- gosimple
- ineffassign
- unused
- errorlint
- gocritic
- revive
linters-settings:
revive:
rules:
- name: exported
disabled: true
issues:
exclude-rules:
# Test files can use dot-imports and assertion helpers freely
- path: _test\.go
linters:
- errcheck
- gocritic

View File

@ -85,5 +85,5 @@ func main() {
func healthCheck(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"status":"ok","service":"cast-ghl-provider"}`))
_, _ = w.Write([]byte(`{"status":"ok","service":"cast-ghl-provider"}`))
}

View File

@ -2,6 +2,7 @@ package store
import (
"context"
"errors"
"time"
"go.mongodb.org/mongo-driver/v2/bson"
@ -61,7 +62,7 @@ func (s *Store) GetToken(ctx context.Context, locationID string) (*TokenRecord,
filter := bson.D{{Key: "location_id", Value: locationID}}
var record TokenRecord
err := s.collection.FindOne(ctx, filter).Decode(&record)
if err == mongo.ErrNoDocuments {
if errors.Is(err, mongo.ErrNoDocuments) {
return nil, nil
}
if err != nil {