-
Notifications
You must be signed in to change notification settings - Fork 206
2.0.0 #131
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
Conversation
oschwald
commented
Jun 22, 2025
- Ugrade to maxminddb-golang/v2
- Add changelog
- Rename IsoCode to ISOCode. Closes IsoCode should be ISOCode #4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the module to v2, updates dependencies and Go versions, switches lookups to use netip.Addr
, renames IsoCode
to ISOCode
, replaces map-based Names
with a structured Names
type, adds changelog entries, and enhances tests and examples for the new APIs.
- Upgrade module path, Go version, and dependencies (including
maxminddb-golang/v2
) - Change all lookup methods to accept
netip.Addr
, renameIsoCode
toISOCode
, and switch to theNames
struct - Expand tests to cover new
Network
,IPAddress
, andIsZero
functionality; update examples accordingly
Reviewed Changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
reader_test.go | Switched tests to netip.Addr , updated field names, added IsZero tests and network/IP assertions |
go.mod | Bumped module path to /v2 , Go version to 1.24, updated dependencies |
example_test.go | Refactored examples to use netip.Addr , struct Names fields, and ISOCode |
CHANGELOG.md | Added v2 changelog entries and migration guide |
.golangci.yml | Updated Go version and disabled conflicting linter (tagalign ) |
.github/workflows/go.yml | Restricted CI matrix to Go 1.24 |
Comments suppressed due to low confidence (4)
reader_test.go:205
- Consider adding assertions for
record.Traits.IPAddress
andrecord.Traits.Network
after this lookup to ensure the new fields are exercised in the Country test, similar to the City tests.
record, err := reader.Country(netip.MustParseAddr("81.2.69.160"))
.golangci.yml:3
- There is a duplicate
go
key under therun
block which may override the intended configuration; consolidate into a single entry or use the proper YAML list syntax.
go: "1.24"
example_test.go:17
- [nitpick] The comment recommends
netip.ParseAddr
with error handling, but the code usesnetip.MustParseAddr
; update the comment to reflectMustParseAddr
or switch the code toParseAddr
with proper error checking.
// If you are using strings that may be invalid, use netip.ParseAddr and check for errors
go.mod:6
- [nitpick] The
go-ruleguard/dsl
dependency was added but isn’t referenced in the code; consider removing it or documenting its intended usage to avoid unnecessary dependency bloat.
github.com/quasilyte/go-ruleguard/dsl v0.3.22
This also updates this module to use netip.Addr instead of net.IP.
This is significantly faster as we don't need to allocate for the keys or create a map.