summaryrefslogtreecommitdiffhomepage
path: root/tools/go_stateify
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-08-12 01:38:25 -0700
committergVisor bot <gvisor-bot@google.com>2021-08-12 01:40:34 -0700
commit3416a3db77bf80cc1100b7d206fe0b68d424d7c9 (patch)
tree2064814293efc948322b38370947087d6b6b1175 /tools/go_stateify
parent96459f55984f655641aa17f7eaac829a170b506a (diff)
Internal change.
PiperOrigin-RevId: 390318725
Diffstat (limited to 'tools/go_stateify')
-rw-r--r--tools/go_stateify/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/go_stateify/main.go b/tools/go_stateify/main.go
index 7216388a0..3cf00b5dd 100644
--- a/tools/go_stateify/main.go
+++ b/tools/go_stateify/main.go
@@ -362,7 +362,12 @@ func main() {
fmt.Fprintf(outputFile, " stateSourceObject.LoadWait(%d, &%s.%s)\n", fields[name], recv, name)
}
emitSaveValue := func(name, typName string) {
- fmt.Fprintf(outputFile, " var %sValue %s = %s.save%s()\n", name, typName, recv, camelCased(name))
+ // Emit typName to be more robust against code generation bugs,
+ // but instead of one line make two lines to silence ST1023
+ // finding (i.e. avoid nogo finding: "should omit type $typName
+ // from declaration; it will be inferred from the right-hand side")
+ fmt.Fprintf(outputFile, " var %sValue %s\n", name, typName)
+ fmt.Fprintf(outputFile, " %sValue = %s.save%s()\n", name, recv, camelCased(name))
fmt.Fprintf(outputFile, " stateSinkObject.SaveValue(%d, %sValue)\n", fields[name], name)
}
emitSave := func(name string) {