dwarf/op: change generated comment header (#3288)
Change generated comment header for opcodes.go to match Go regexp: ``` ^// Code generated .* DO NOT EDIT\.$ ``` Fix panic in gen-opcodes.go if no args provided.
This commit is contained in:
parent
37e44bf603
commit
d71b3aa6a7
@ -1,4 +1,5 @@
|
||||
// This script generates pkg/dwarf/op/opcodes.go from pkg/dwarf/op/opcodes.txt
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
@ -19,7 +20,17 @@ type Opcode struct {
|
||||
Func string
|
||||
}
|
||||
|
||||
func usage() {
|
||||
os.Stderr.WriteString("gen-opcodes <opcodes-table-path> <opcodes-destination-path>\n\n")
|
||||
os.Stderr.WriteString("Generates Go file <opcodes-destination-path> from the table file <opcodes-table-path>.\n\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) != 3 {
|
||||
usage()
|
||||
}
|
||||
|
||||
fh, err := os.Open(os.Args[1])
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@ -52,8 +63,9 @@ func main() {
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
||||
fmt.Fprintf(&buf, `// THIS FILE IS AUTOGENERATED, EDIT opcodes.table INSTEAD
|
||||
|
||||
fmt.Fprintf(&buf, `// Code generated by gen-opcodes. DO NOT EDIT.
|
||||
// Edit opcodes.table instead.
|
||||
|
||||
package op
|
||||
`)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// THIS FILE IS AUTOGENERATED, EDIT opcodes.table INSTEAD
|
||||
// Code generated by gen-opcodes. DO NOT EDIT.
|
||||
// Edit opcodes.table instead.
|
||||
|
||||
package op
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user