diff options
author | Adin Scannell <ascannell@google.com> | 2021-01-12 12:36:17 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-12 12:38:22 -0800 |
commit | 4e03e87547853523d4ff941935a6ef1712518c61 (patch) | |
tree | e930ce0e5f15f7041e7b74daca05acc7afbd2558 /tools/go_marshal | |
parent | a20da708291e2e5bdece5176dce61c1b4b10b7d9 (diff) |
Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor
fixes are also included and tests added where appropriate.
PiperOrigin-RevId: 351425971
Diffstat (limited to 'tools/go_marshal')
-rw-r--r-- | tools/go_marshal/analysis/analysis_unsafe.go | 2 | ||||
-rw-r--r-- | tools/go_marshal/gomarshal/generator.go | 2 | ||||
-rw-r--r-- | tools/go_marshal/gomarshal/generator_interfaces_struct.go | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/tools/go_marshal/analysis/analysis_unsafe.go b/tools/go_marshal/analysis/analysis_unsafe.go index cd55cf5cb..7a3d6bbea 100644 --- a/tools/go_marshal/analysis/analysis_unsafe.go +++ b/tools/go_marshal/analysis/analysis_unsafe.go @@ -81,7 +81,7 @@ func RandomizeValue(x interface{}) { // This is used for zeroing padding fields after calling RandomizeValue. func reflectZeroPaddingFields(r reflect.Type, data []byte, zero bool) { if zero { - for i, _ := range data { + for i := range data { data[i] = 0 } } diff --git a/tools/go_marshal/gomarshal/generator.go b/tools/go_marshal/gomarshal/generator.go index 28ae6c4ef..fa642c88a 100644 --- a/tools/go_marshal/gomarshal/generator.go +++ b/tools/go_marshal/gomarshal/generator.go @@ -148,7 +148,7 @@ func (g *Generator) writeTypeChecks(ms map[string]struct{}) error { } msl := make([]string, 0, len(ms)) - for m, _ := range ms { + for m := range ms { msl = append(msl, m) } sort.Strings(msl) diff --git a/tools/go_marshal/gomarshal/generator_interfaces_struct.go b/tools/go_marshal/gomarshal/generator_interfaces_struct.go index fe76d3785..5f6306b8f 100644 --- a/tools/go_marshal/gomarshal/generator_interfaces_struct.go +++ b/tools/go_marshal/gomarshal/generator_interfaces_struct.go @@ -38,7 +38,7 @@ func (g *interfaceGenerator) areFieldsPackedExpression() (string, bool) { } cs := make([]string, 0, len(g.as)) - for accessor, _ := range g.as { + for accessor := range g.as { cs = append(cs, fmt.Sprintf("%s.Packed()", accessor)) } // Sort expressions for determinstic build outputs. |