Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for new golangci-lint #346

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ disable = [
# We don't follow its policy about not defining dynamic errors.
"err113",

# This doesn't seem to know about CTEs or DELETEs with RETURNING
"execinquery",

# We often don't initialize all of the struct fields. This is fine
# generally
"exhaustruct",
Expand All @@ -51,9 +48,6 @@ disable = [
"gocognit",
"godox",

# We have to disable both "gomnd" and "mnd" temporarily, apparently.
"gomnd",

# This only "caught" one thing, and it seemed like a reasonable use
# of Han script. Generally, I don't think we want to prevent the use
# of particular scripts. The time.Local checks might be useful, but
Expand Down
2 changes: 2 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
// Client downloads GeoIP2 and GeoLite2 MMDB databases.
//
// After creation, it is valid for concurrent use.
//
//nolint:recvcheck // changing this would be a breaking change.
type Client struct {
accountID int
endpoint string
Expand Down
8 changes: 6 additions & 2 deletions internal/geoipupdate/database/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ type ReadResult struct {
}

// MarshalJSON is a custom json marshaler that strips out zero time fields.
func (r ReadResult) MarshalJSON() ([]byte, error) {
func (r *ReadResult) MarshalJSON() ([]byte, error) {
if r == nil {
return []byte("null"), nil
}

type partialResult ReadResult
s := &struct {
partialResult
ModifiedAt int64 `json:"modified_at,omitempty"`
CheckedAt int64 `json:"checked_at,omitempty"`
}{
partialResult: partialResult(r),
partialResult: partialResult(*r),
ModifiedAt: 0,
CheckedAt: 0,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/geoipupdate/geoip_updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (w *mockWriter) Write(
return nil
}

func (w mockWriter) GetHash(editionID string) (string, error) {
func (w *mockWriter) GetHash(editionID string) (string, error) {
return w.md5s[editionID], nil
}

Expand Down
Loading