Skip to content

Comments

feat: support net.IP/net.IPMask/net.IPNet/[]net.IP across flags, env, and config#54

Merged
leodido merged 5 commits intomainfrom
codex/pr2a-net-type-hooks
Feb 23, 2026
Merged

feat: support net.IP/net.IPMask/net.IPNet/[]net.IP across flags, env, and config#54
leodido merged 5 commits intomainfrom
codex/pr2a-net-type-hooks

Conversation

@leodido
Copy link
Owner

@leodido leodido commented Feb 23, 2026

Summary

  • implement net-family exact-type support
  • add built-in define/decode hook coverage for:
    • net.IP
    • net.IPMask
    • net.IPNet
    • []net.IP

Changes

  • register net-family define hooks in internal/hooks/define.go
  • register net-family decode hooks in internal/hooks/decode.go
    • reuse mapstructure built-ins for net.IP and net.IPNet
    • add custom decode hooks for net.IPMask and []net.IP
  • add net pflag value implementations in values/net.go
  • update validation to treat built-in-hook struct types as leaf/scalar fields (needed for net.IPNet)
  • update env key generation so hooked struct-backed fields can bind env vars (needed for net.IPNet)
  • add focused integration tests in internal/hooks/hooks_test.go for flag/env/config and invalid-input cases
  • add code comments clarifying CSV parsing semantics and the validation leaf-type rule

Testing

  • go test -count=1 ./...

@leodido leodido self-assigned this Feb 23, 2026
@leodido leodido changed the title feat: add net IP family exact-type hook support feat: support net.IP/net.IPMask/net.IPNet/[]net.IP across flags, env, and config Feb 23, 2026
@leodido leodido merged commit 5cdada4 into main Feb 23, 2026
4 checks passed
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.

1 participant