FAQ
Reviewers: golang-dev1,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go.net


Description:
go.net/ipv4: simplify protocol constants generator

Also updates IANA protocol constants.

Please review this at https://codereview.appspot.com/14588043/

Affected files (+45, -52 lines):
    M ipv4/gen.go
    M ipv4/gentest.go
    M ipv4/iana_test.go


Index: ipv4/gen.go
===================================================================
--- a/ipv4/gen.go
+++ b/ipv4/gen.go
@@ -97,20 +97,16 @@
   }

   type icmpv4Parameters struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Registries []icmpv4ParamRegistry `xml:"registry"`
-}
-
-type icmpv4ParamRegistry struct {
- Title string `xml:"title"`
- Records []icmpv4ParamRecord `xml:"record"`
-}
-
-type icmpv4ParamRecord struct {
- Value string `xml:"value"`
- Descr string `xml:"description"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Registries []struct {
+ Title string `xml:"title"`
+ Records []struct {
+ Value string `xml:"value"`
+ Descr string `xml:"description"`
+ } `xml:"record"`
+ } `xml:"registry"`
   }

   type canonICMPv4ParamRecord struct {
@@ -193,18 +189,16 @@
   }

   type protocolNumbers struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- RegTitle string `xml:"registry>title"`
- Note string `xml:"registry>note"`
- Records []protocolRecord `xml:"registry>record"`
-}
-
-type protocolRecord struct {
- Value string `xml:"value"`
- Name string `xml:"name"`
- Descr string `xml:"description"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ RegTitle string `xml:"registry>title"`
+ Note string `xml:"registry>note"`
+ Records []struct {
+ Value string `xml:"value"`
+ Name string `xml:"name"`
+ Descr string `xml:"description"`
+ } `xml:"registry>record"`
   }

   type canonProtocolRecord struct {
Index: ipv4/gentest.go
===================================================================
--- a/ipv4/gentest.go
+++ b/ipv4/gentest.go
@@ -39,7 +39,7 @@

   func main() {
    var bb bytes.Buffer
- fmt.Fprintf(&bb, "// go run gentv.go\n")
+ fmt.Fprintf(&bb, "// go run gentest.go\n")
    fmt.Fprintf(&bb, "// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT\n\n")
    fmt.Fprintf(&bb, "package ipv4_test\n\n")
    for _, r := range registries {
@@ -85,18 +85,19 @@
   }

   type dscpRegistry struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Note string `xml:"note"`
- RegTitle string `xml:"registry>title"`
- PoolRecords []dscpRecord `xml:"registry>record"`
- Records []dscpRecord `xml:"registry>registry>record"`
-}
-
-type dscpRecord struct {
- Name string `xml:"name"`
- Space string `xml:"space"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Note string `xml:"note"`
+ RegTitle string `xml:"registry>title"`
+ PoolRecords []struct {
+ Name string `xml:"name"`
+ Space string `xml:"space"`
+ } `xml:"registry>record"`
+ Records []struct {
+ Name string `xml:"name"`
+ Space string `xml:"space"`
+ } `xml:"registry>registry>record"`
   }

   type canonDSCPRecord struct {
@@ -145,17 +146,15 @@
   }

   type tosTCByte struct {
- XMLName xml.Name `xml:"registry"`
- Title string `xml:"title"`
- Updated string `xml:"updated"`
- Note string `xml:"note"`
- RegTitle string `xml:"registry>title"`
- Records []tosTCByteRecord `xml:"registry>record"`
-}
-
-type tosTCByteRecord struct {
- Binary string `xml:"binary"`
- Keyword string `xml:"keyword"`
+ XMLName xml.Name `xml:"registry"`
+ Title string `xml:"title"`
+ Updated string `xml:"updated"`
+ Note string `xml:"note"`
+ RegTitle string `xml:"registry>title"`
+ Records []struct {
+ Binary string `xml:"binary"`
+ Keyword string `xml:"keyword"`
+ } `xml:"registry>record"`
   }

   type canonTOSTCByteRecord struct {
Index: ipv4/iana_test.go
===================================================================
--- a/ipv4/iana_test.go
+++ b/ipv4/iana_test.go
@@ -1,9 +1,9 @@
-// go run gentv.go
+// go run gentest.go
   // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT

   package ipv4_test

-// Differentiated Services Field Codepoints, Updated: 2010-05-11
+// Differentiated Services Field Codepoints (DSCP), Updated: 2013-06-25
   const (
    DiffServCS0 = 0x0 // CS0
    DiffServCS1 = 0x20 // CS1


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 9, '13 at 7:01p
activeOct 9, '13 at 7:01p
posts1
users1
websitegolang.org

1 user in discussion

Mikioh Mikioh: 1 post

People

Translate

site design / logo © 2022 Grokbase