From 3416a3db77bf80cc1100b7d206fe0b68d424d7c9 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 12 Aug 2021 01:38:25 -0700 Subject: Internal change. PiperOrigin-RevId: 390318725 --- tools/go_stateify/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/go_stateify') 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) { -- cgit v1.2.3