Skip to content

Conversation

@oschwald
Copy link
Owner

@oschwald oschwald requested a review from Copilot June 22, 2025 21:13
Copy link

Copilot AI left a 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, rename IsoCode to ISOCode, and switch to the Names struct
  • Expand tests to cover new Network, IPAddress, and IsZero 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 and record.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 the run 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 uses netip.MustParseAddr; update the comment to reflect MustParseAddr or switch the code to ParseAddr 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 
@oschwald oschwald merged commit d9bfea2 into main Jun 22, 2025
11 checks passed
@oschwald oschwald deleted the greg/v2 branch June 22, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants