Update IP struct fields and migrate to Go modules#21
Merged
jonathan-kosgei merged 3 commits intomasterfrom Feb 23, 2026
Merged
Conversation
- Fix critical bug: Languages JSON tag used "language" (singular) instead of "languages" (plural), causing language data to be silently dropped - Add Company struct and field for the company API response object - Add Language.Code field for ISO 639-1 language codes - Add Count and Status response metadata fields - Add missing RegionCode and Carrier fields to bulkIP struct - Add LookupFields/LookupFieldsWithContext methods for field filtering via the API's fields query parameter - Migrate from dep (Gopkg.toml/vendor) to Go modules (go.mod) - Replace deprecated io/ioutil with io package equivalents - Remove deprecated DualStack field from net.Dialer - Update test fixtures to cover all new fields including Company, threat scores, blocklists, and language codes - Bump version from 0.7.1 to 0.8.0 https://claude.ai/code/session_01TQxWtmbL5KCKpHRb2GLQ5q
- Add NewEUClient constructor that routes requests through EU data centers only (Frankfurt, Paris, Ireland) for GDPR compliance - Export euAPIEndpoint constant (https://eu-api.ipdata.co/) - Rewrite README with updated badges, installation instructions, usage examples for all features (Lookup, LookupFields, BulkLookup, EU endpoint, error handling), and full response field reference - Add TestNewEUClient test cases https://claude.ai/code/session_01TQxWtmbL5KCKpHRb2GLQ5q
- Remove .travis.yml - Add .github/workflows/ci.yml with test matrix (Go 1.21-1.24), race detection, coverage, and staticcheck - Update Makefile to remove dep-era prebuild/lint targets - Update README badges: add GitHub Actions CI badge, replace godoc badge with pkg.go.dev reference badge https://claude.ai/code/session_01TQxWtmbL5KCKpHRb2GLQ5q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the IP data structure to match the latest API response format and modernizes the project's dependency management.
Summary
Updated the
IPstruct to include new fields (RegionCode,EmojiFlag) and corrected existing field mappings. Additionally, migrated fromdepto Go modules for dependency management and removed vendor directory in favor of module-based dependencies.Key Changes
IP struct updates (
types.go):RegionCodefield to capture region/state codesEmojiFlagfield for emoji flag representationEmojiUnicodefield to store the correct format (removed quotes from JSON tag)LanguagesJSON tag fromlanguagetolanguagesDependency management:
Gopkg.tomlandGopkg.lock(dep-based configuration)go.modwith Go 1.24.7 and explicit dependencies ongoogle/go-cmpandpkg/errorsCode modernization (
client.go,client_test.go):io/ioutil.ReadAllwithio.ReadAllstringsimport where neededImplementation Details
The struct field changes ensure proper deserialization of the IP geolocation API responses, particularly for region codes and emoji flag representations. The migration to Go modules simplifies dependency management and aligns with modern Go best practices.
https://claude.ai/code/session_01TQxWtmbL5KCKpHRb2GLQ5q