Skip to content
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

support marshal net.ParseIP(127.0.0.1) to 127.0.0.1 #34

Closed
bronze1man opened this issue Jan 13, 2022 · 3 comments · Fixed by #43
Closed

support marshal net.ParseIP(127.0.0.1) to 127.0.0.1 #34

bronze1man opened this issue Jan 13, 2022 · 3 comments · Fixed by #43

Comments

@bronze1man
Copy link
Contributor

bronze1man commented Jan 13, 2022

support marshal net.ParseIP(127.0.0.1) to 127.0.0.1

current result:

[
  0
  0
  0
  0
  0
  0
  0
  0
  0
  0
  255
  255
  127
  0
  0
  1
]

support encoding.TextMarshaler should fix this bug.

@trobro
Copy link
Member

trobro commented Jan 13, 2022

The current result is consistent with doing fmt.Printf of such an object:

net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x1}

@bronze1man
Copy link
Contributor Author

The current result is not consistent with json.Marshal of such an object.

@trobro
Copy link
Member

trobro commented Jan 14, 2022

I see, it would have been better to be consistent with json.Marshal. Unfortunately changing that now would be a breaking change, it could cause problems for people who depend on the current behavior of Hjson. Let's leave this issue open, maybe we can do a 4.0 release in the future with breaking changes like this one.

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 a pull request may close this issue.

2 participants