]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: set exit status for failing "go generate" run.
authorRob Pike <r@golang.org>
Mon, 20 Oct 2014 20:27:41 +0000 (13:27 -0700)
committerRob Pike <r@golang.org>
Mon, 20 Oct 2014 20:27:41 +0000 (13:27 -0700)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/154360048

src/cmd/go/generate.go

index 167758207e3301a8703a80fdddc0ab090728a8c2..4227abbe7c50a66bbf29f07447c5869d7d56a120 100644 (file)
@@ -169,6 +169,7 @@ func (g *Generator) run() (ok bool) {
                        if e != stop {
                                panic(e)
                        }
+                       setExitStatus(1)
                }
        }()
        g.dir, g.file = filepath.Split(g.path)
@@ -267,7 +268,8 @@ Words:
 var stop = fmt.Errorf("error in generation")
 
 // errorf logs an error message prefixed with the file and line number.
-// It then exits the program because generation stops at the first error.
+// It then exits the program (with exit status 1) because generation stops
+// at the first error.
 func (g *Generator) errorf(format string, args ...interface{}) {
        fmt.Fprintf(os.Stderr, "%s:%d: %s\n", shortPath(g.path), g.lineNum,
                fmt.Sprintf(format, args...))