Skip to content

Commit

Permalink
Don't mix receiver type
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Nov 11, 2024
1 parent c10b1ab commit d9ff683
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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

0 comments on commit d9ff683

Please sign in to comment.