Skip to content

Commit b386c73

Browse files
committed
cmd/go: fix go generate docs
The docs were never updated for the change to the placement of the DO NOT EDIT line. Also, the description of the DO NOT EDIT line interrupted the description of the //go:generate line, which made for some confusing references in the text that followed. Move it lower. Fixes #41196. Change-Id: I6af2a199fa98d45f5ccac7cdf7e9e54257699e61 Reviewed-on: https://go-review.googlesource.com/c/go/+/283633 Trust: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent bb5075a commit b386c73

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/cmd/go/alldocs.go

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/generate/generate.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ that can be run locally. It must either be in the shell path
5252
(gofmt), a fully qualified path (/usr/you/bin/mytool), or a
5353
command alias, described below.
5454
55-
To convey to humans and machine tools that code is generated,
56-
generated source should have a line that matches the following
57-
regular expression (in Go syntax):
58-
59-
^// Code generated .* DO NOT EDIT\.$
60-
61-
The line may appear anywhere in the file, but is typically
62-
placed near the beginning so it is easy to find.
63-
6455
Note that go generate does not parse the file, so lines that look
6556
like directives in comments or multiline strings will be treated
6657
as directives.
@@ -72,6 +63,15 @@ arguments when it is run.
7263
Quoted strings use Go syntax and are evaluated before execution; a
7364
quoted string appears as a single argument to the generator.
7465
66+
To convey to humans and machine tools that code is generated,
67+
generated source should have a line that matches the following
68+
regular expression (in Go syntax):
69+
70+
^// Code generated .* DO NOT EDIT\.$
71+
72+
This line must appear before the first non-comment, non-blank
73+
text in the file.
74+
7575
Go generate sets several variables when it runs the generator:
7676
7777
$GOARCH

0 commit comments

Comments
 (0)