Add a comment about running "go generate".

This commit is contained in:
Nigel Tao committed 2017-05-26 09:16:00 +10:00
1 parent 6e7decbf3b
commit 3f79592b9a
2 files changed
+12 -1

No files matched your search

+10 -1
View File
@@ -27,11 +27,20 @@ func main() {
}
func main1() error {
in, err := ioutil.ReadFile("preamble.h")
const inFilename = "preamble.h"
in, err := ioutil.ReadFile(inFilename)
if err != nil {
return err
}
const afterEditing = "// After editing this file,"
if !bytes.HasPrefix(in, []byte(afterEditing)) {
return fmt.Errorf("%s's contents do not start with %q", inFilename, afterEditing)
}
if i := bytes.Index(in, []byte("\n\n")); i >= 0 {
in = in[i+2:]
}
out := &bytes.Buffer{}
out.WriteString("// Code generated by running \"go generate\". DO NOT EDIT.\n")
out.WriteString("\n")
+2
View File
@@ -1,3 +1,5 @@
// After editing this file, run "go generate" in this directory.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.