summaryrefslogtreecommitdiff
path: root/libgo/go/cmd
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-06 16:19:05 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-06 16:19:05 +0000
commitd145bc231855ad5d6df1feb0bc7f283e4c404a90 (patch)
tree122e64d46042099f2d5b39e31532f3d0358b5ad3 /libgo/go/cmd
parentf91d0326c12847ab2f48285f865db5793db5d1bc (diff)
downloadgcc-d145bc231855ad5d6df1feb0bc7f283e4c404a90.tar.gz
libgo: Upgrade to Go 1.4.2 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221245 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/cmd')
-rw-r--r--libgo/go/cmd/go/doc.go1
-rw-r--r--libgo/go/cmd/go/generate.go5
-rw-r--r--libgo/go/cmd/go/generate_test.go6
-rw-r--r--libgo/go/cmd/go/get.go2
4 files changed, 13 insertions, 1 deletions
diff --git a/libgo/go/cmd/go/doc.go b/libgo/go/cmd/go/doc.go
index d0d8a8a5b2e..7191ee0f3a9 100644
--- a/libgo/go/cmd/go/doc.go
+++ b/libgo/go/cmd/go/doc.go
@@ -308,6 +308,7 @@ The generator is run in the package's source directory.
Go generate accepts one specific flag:
-run=""
+ TODO: This flag is unimplemented.
if non-empty, specifies a regular expression to
select directives whose command matches the expression.
diff --git a/libgo/go/cmd/go/generate.go b/libgo/go/cmd/go/generate.go
index baf4d2b55c1..3c0af8760b5 100644
--- a/libgo/go/cmd/go/generate.go
+++ b/libgo/go/cmd/go/generate.go
@@ -106,6 +106,7 @@ The generator is run in the package's source directory.
Go generate accepts one specific flag:
-run=""
+ TODO: This flag is unimplemented.
if non-empty, specifies a regular expression to
select directives whose command matches the expression.
@@ -255,6 +256,10 @@ func (g *Generator) split(line string) []string {
// Parse line, obeying quoted strings.
var words []string
line = line[len("//go:generate ") : len(line)-1] // Drop preamble and final newline.
+ // There may still be a carriage return.
+ if len(line) > 0 && line[len(line)-1] == '\r' {
+ line = line[:len(line)-1]
+ }
// One (possibly quoted) word per iteration.
Words:
for {
diff --git a/libgo/go/cmd/go/generate_test.go b/libgo/go/cmd/go/generate_test.go
index 660ebabbe84..2ec548630ac 100644
--- a/libgo/go/cmd/go/generate_test.go
+++ b/libgo/go/cmd/go/generate_test.go
@@ -40,9 +40,15 @@ func TestGenerateCommandParse(t *testing.T) {
}
g.setShorthand([]string{"-command", "yacc", "go", "tool", "yacc"})
for _, test := range splitTests {
+ // First with newlines.
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)
}
+ // Then with CRLFs, thank you Windows.
+ got = g.split("//go:generate " + test.in + "\r\n")
+ if !reflect.DeepEqual(got, test.out) {
+ t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
+ }
}
}
diff --git a/libgo/go/cmd/go/get.go b/libgo/go/cmd/go/get.go
index 86e1697618a..50e0ca93bf4 100644
--- a/libgo/go/cmd/go/get.go
+++ b/libgo/go/cmd/go/get.go
@@ -290,7 +290,7 @@ func downloadPackage(p *Package) error {
}
}
if remote != repo {
- return fmt.Errorf("%s is from %s, should be from %s", dir, remote, repo)
+ return fmt.Errorf("%s is a custom import path for %s, but %s is checked out from %s", rr.root, repo, dir, remote)
}
}
}