]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/go: fix build
authorRob Pike <r@golang.org>
Fri, 5 Dec 2014 00:37:56 +0000 (09:37 +0900)
committerRob Pike <r@golang.org>
Fri, 5 Dec 2014 00:37:56 +0000 (09:37 +0900)
The new semantics of split require the newline be present.
The test was stale.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/182480043

src/cmd/go/generate.go
src/cmd/go/generate_test.go

index 88f7efa0f34224462cd1c8cc3bbaaca8d9897c3b..baf4d2b55c1f8792c1794fc46ff8d895bfdf31e9 100644 (file)
@@ -250,7 +250,7 @@ func isGoGenerate(buf []byte) bool {
 
 // split breaks the line into words, evaluating quoted
 // strings and evaluating environment variables.
-// The initial //go:generate element is dropped.
+// The initial //go:generate element is present in line.
 func (g *Generator) split(line string) []string {
        // Parse line, obeying quoted strings.
        var words []string
index 93c0ae66e9b3d592030b5da58bfc81d45d26cc65..660ebabbe84d8b2d5593bca35fec4b137c9fd421 100644 (file)
@@ -40,7 +40,7 @@ func TestGenerateCommandParse(t *testing.T) {
        }
        g.setShorthand([]string{"-command", "yacc", "go", "tool", "yacc"})
        for _, test := range splitTests {
-               got := g.split("//go:generate " + test.in)
+               got := g.split("//go:generate " + test.in + "\n")
                if !reflect.DeepEqual(got, test.out) {
                        t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
                }