summaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/generate
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-08-24 11:34:12 -0700
committerRob Pike <r@golang.org>2014-08-24 11:34:12 -0700
commit41fc05d02357b8681b7a5adfbaedf315328d309e (patch)
tree996d52f17eaf2c7c1dc5e40b984bac7fb4c8dee8 /src/cmd/go/testdata/generate
parentcbf351a0f29338ed2ff307729a1b3acacbb110db (diff)
downloadgo-git-41fc05d02357b8681b7a5adfbaedf315328d309e.tar.gz
cmd/go: add go generate
First cut. Works well enough to support yacc via https://golang.org/cl/125620044. LGTM=alex.brainman, rsc R=rsc, alex.brainman CC=golang-codereviews https://golang.org/cl/125580044
Diffstat (limited to 'src/cmd/go/testdata/generate')
-rw-r--r--src/cmd/go/testdata/generate/test1.go13
-rw-r--r--src/cmd/go/testdata/generate/test2.go10
-rw-r--r--src/cmd/go/testdata/generate/test3.go9
3 files changed, 32 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/generate/test1.go b/src/cmd/go/testdata/generate/test1.go
new file mode 100644
index 0000000000..1f05734f04
--- /dev/null
+++ b/src/cmd/go/testdata/generate/test1.go
@@ -0,0 +1,13 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Simple test for go generate.
+
+// We include a build tag that go generate should ignore.
+
+// +build ignore
+
+//go:generate echo Success
+
+package p
diff --git a/src/cmd/go/testdata/generate/test2.go b/src/cmd/go/testdata/generate/test2.go
new file mode 100644
index 0000000000..ef1a3d9515
--- /dev/null
+++ b/src/cmd/go/testdata/generate/test2.go
@@ -0,0 +1,10 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test that go generate handles command aliases.
+
+//go:generate -command run echo Now is the time
+//go:generate run for all good men
+
+package p
diff --git a/src/cmd/go/testdata/generate/test3.go b/src/cmd/go/testdata/generate/test3.go
new file mode 100644
index 0000000000..41ffb7ea87
--- /dev/null
+++ b/src/cmd/go/testdata/generate/test3.go
@@ -0,0 +1,9 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test go generate variable substitution.
+
+//go:generate echo $GOARCH $GOFILE $GOPACKAGE xyz$GOPACKAGE/$GOFILE/123
+
+package p