Skip to content

Update IP struct fields and migrate to Go modules#21

Merged
jonathan-kosgei merged 3 commits intomasterfrom
claude/update-ipdata-go-package-tDBG9
Feb 23, 2026
Merged

Update IP struct fields and migrate to Go modules#21
jonathan-kosgei merged 3 commits intomasterfrom
claude/update-ipdata-go-package-tDBG9

Conversation

@jonathan-kosgei
Copy link
Collaborator

This PR updates the IP data structure to match the latest API response format and modernizes the project's dependency management.

Summary

Updated the IP struct to include new fields (RegionCode, EmojiFlag) and corrected existing field mappings. Additionally, migrated from dep to Go modules for dependency management and removed vendor directory in favor of module-based dependencies.

Key Changes

  • IP struct updates (types.go):

    • Added RegionCode field to capture region/state codes
    • Added EmojiFlag field for emoji flag representation
    • Fixed EmojiUnicode field to store the correct format (removed quotes from JSON tag)
    • Corrected Languages JSON tag from language to languages
    • Updated test expectations to match new struct fields
  • Dependency management:

    • Removed Gopkg.toml and Gopkg.lock (dep-based configuration)
    • Added go.mod with Go 1.24.7 and explicit dependencies on google/go-cmp and pkg/errors
    • Removed vendor directory (now managed by Go modules)
  • Code modernization (client.go, client_test.go):

    • Replaced deprecated io/ioutil.ReadAll with io.ReadAll
    • Added strings import where needed

Implementation 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

- 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
@jonathan-kosgei jonathan-kosgei merged commit 2c9f103 into master Feb 23, 2026
5 checks passed
@jonathan-kosgei jonathan-kosgei deleted the claude/update-ipdata-go-package-tDBG9 branch February 23, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants