From f702249ef26bab737aea44404da64e4cda66539f Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Wed, 20 Dec 2023 09:59:28 -0800 Subject: [PATCH] generate-gnostic: fix dropped errors (#415) --- generate-gnostic/generate-extension.go | 3 +++ generate-gnostic/generate-extension_test.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/generate-gnostic/generate-extension.go b/generate-gnostic/generate-extension.go index b8456185..27270d30 100644 --- a/generate-gnostic/generate-extension.go +++ b/generate-gnostic/generate-extension.go @@ -281,6 +281,9 @@ func generateExtension(schemaFile string, outDir string) error { return err } err = exec.Command(runtime.GOROOT()+"/bin/gofmt", "-w", goFilename).Run() + if err != nil { + return err + } // generate the main file. diff --git a/generate-gnostic/generate-extension_test.go b/generate-gnostic/generate-extension_test.go index 9ec62be5..344848f8 100644 --- a/generate-gnostic/generate-extension_test.go +++ b/generate-gnostic/generate-extension_test.go @@ -16,6 +16,9 @@ func TestErrorExtensionGeneratorUnsupportedPrimitive(t *testing.T) { "test/x-unsupportedprimitives.json", "--out_dir=/tmp", ).Output() + if err != nil { + t.Fatalf("error executing generate-gnostic: %v", err) + } outputFile := "x-unsupportedprimitives.errors" _ = ioutil.WriteFile(outputFile, output, 0644) @@ -38,6 +41,9 @@ func TestErrorExtensionGeneratorNameCollision(t *testing.T) { "test/x-extension-name-collision.json", "--out_dir=/tmp", ).Output() + if err != nil { + t.Fatalf("error executing generate-gnostic: %v", err) + } outputFile := "x-extension-name-collision.errors" _ = ioutil.WriteFile(outputFile, output, 0644)