Skip to content

net: add text marshalling and unmarshalling for HardwareAddr #34452

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

Closed
wants to merge 5 commits into from

Conversation

klnusbaum
Copy link

The HardwareAddr type has the ability to be transformed to and from a
string. However, this capability is not exposed in a manner suitable
for use with various forms of marshalling and unmarshaling of text
(e.g. JSON or YAML). Let's add the proper functions so that
HardwareAddr implements the TextMarshaller and TextUnmarshaler
interfaces from the encoding package.

Fixes #29678

@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Sep 21, 2019
@gopherbot
Copy link
Contributor

This PR (HEAD: 85a3e00) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/196817 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 1: Code-Review-1

Hey Kurtis, thank you for submitting this! I think we should wait for the issue to resolve first w.r.t the backwards compatibility concerns.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: b18832e) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/196817 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Kurtis Nusbaum:

Patch Set 2:

Patch Set 1: Code-Review-1

Hey Kurtis, thank you for submitting this! I think we should wait for the issue to resolve first w.r.t the backwards compatibility concerns.

Hey Ankhil,
Looks like we've got a solution for the backwards compatibility concerns. Would it be ok if we move forward with a more in-depth review of the change now?


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Used by googlebot to label PRs as having an invalid CLA. The text of this label should not change. and removed cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. labels Sep 26, 2019
The HardwareAddr type has the ability to be transformed to and from a
string. However, this capability is not exposed in a manner suitable
for use with various forms of marshalling and unmarshaling of text
(e.g. JSON or YAML). Let's add the proper functions so that
HardwareAddr implements the TextMarshaller and TextUnmarshaler
interfaces from the encoding package.

Fixes golang#29678
- Create `matchErr` function and simplify result testing in `TestHardwareAddr_UnmarshalText`
- Fix Lbrace in `TestHardwareAddr_UnmarshalText`
- Change `Fatalf`s to just `Fatal`s in `TestHardwareAddr_MarshalText`
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. and removed cla: no Used by googlebot to label PRs as having an invalid CLA. The text of this label should not change. labels Sep 30, 2019
@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 2:

(7 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: df49700) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/196817 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

This PR (HEAD: 9e07592) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/196817 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 5660642) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/196817 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 5: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot gopherbot force-pushed the master branch 2 times, most recently from 07b4abd to 19a7490 Compare October 9, 2019 22:40
@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 5: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=2afdb754


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5:

Build is still in progress...
This change failed on freebsd-amd64-12_0:
See https://storage.googleapis.com/go-build-log/2afdb754/freebsd-amd64-12_0_0528e059.log

Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5: TryBot-Result-1

9 of 19 TryBots failed:
Failed on freebsd-amd64-12_0: https://storage.googleapis.com/go-build-log/2afdb754/freebsd-amd64-12_0_0528e059.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/2afdb754/linux-amd64_57e4afc1.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/2afdb754/linux-386_d91beb89.log
Failed on openbsd-amd64-64: https://storage.googleapis.com/go-build-log/2afdb754/openbsd-amd64-64_bc6e04ea.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/2afdb754/windows-amd64-2016_d2cb17ac.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/2afdb754/linux-amd64-race_48f6fd66.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/2afdb754/windows-386-2008_b87480fe.log
Failed on android-amd64-emu: https://storage.googleapis.com/go-build-log/2afdb754/android-amd64-emu_f2f0d8ac.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/2afdb754/js-wasm_0c6aa72d.log

Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Akhil Indurti:

Patch Set 5: -Run-TryBot -Code-Review

Seems like the base64 import violates the policy defined in go/build/deps_test.go. Is it absolutely needed for Unmarshal? If so, this needs to be discussed in the issue.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Kurtis Nusbaum:

Patch Set 5:

Patch Set 5: -Run-TryBot -Code-Review

Seems like the base64 import violates the policy defined in go/build/deps_test.go. Is it absolutely needed for Unmarshal? If so, this needs to be discussed in the issue.

Hey Akhil,

This actually was discussed on the issue. The claim was that in order to be truly backwards compatible with pervious versions of Go, we needed to be able to decode the potentially base64 encoded byte arrays that theoretically may be have serialized in current and previous versions of Go. I don't know of any other way to do that besides using the base64 package (or copy and pasting from the base64 package). It seems we're stuck between two requirements here. Which would you prefer I go with? Or is there a third option?


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 5:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=2afdb754


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 5:

Build is still in progress...
This change failed on freebsd-amd64-12_0:
See https://storage.googleapis.com/go-build-log/2afdb754/freebsd-amd64-12_0_0528e059.log

Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go Bot:

Patch Set 5: TryBot-Result-1

9 of 19 TryBots failed:
Failed on freebsd-amd64-12_0: https://storage.googleapis.com/go-build-log/2afdb754/freebsd-amd64-12_0_0528e059.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/2afdb754/linux-amd64_57e4afc1.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/2afdb754/linux-386_d91beb89.log
Failed on openbsd-amd64-64: https://storage.googleapis.com/go-build-log/2afdb754/openbsd-amd64-64_bc6e04ea.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/2afdb754/windows-amd64-2016_d2cb17ac.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/2afdb754/linux-amd64-race_48f6fd66.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/2afdb754/windows-386-2008_b87480fe.log
Failed on android-amd64-emu: https://storage.googleapis.com/go-build-log/2afdb754/android-amd64-emu_f2f0d8ac.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/2afdb754/js-wasm_0c6aa72d.log

Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.


Please don’t reply on this GitHub thread. Visit golang.org/cl/196817.
After addressing review feedback, remember to publish your drafts!

@heschi heschi closed this Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

net: add MarshalText/UnmarshalText to HardwareAddr
4 participants