Closed finch039 closed 3 years ago
(echo "// Code generated by goyacc. DO NOT EDIT."; \ echo "// GENERATED FILE DO NOT EDIT"; \ cat pkg/sql/parser/gen/sql.go.tmp | \ sed -E 's/^const ([A-Z][_A-Z0-9]) =.$/const \1 = lex.\1/g') > pkg/sql/parser/sql.go.tmp || rm pkg/sql/parser/sql.go.tmp mv -f pkg/sql/parser/sql.go.tmp pkg/sql/parser/sql.go goimports -w pkg/sql/parser/sql.go (echo "// Code generated by make. DO NOT EDIT."; \ echo "// GENERATED FILE DO NOT EDIT"; \ echo; \ echo "package lex"; \ echo; \ grep '^const [A-Z][_A-Z0-9]* ' pkg/sql/parser/gen/sql.go.tmp) > pkg/sql/lex/tokens.go.tmp || rm pkg/sql/lex/tokens.go.tmp mv -f pkg/sql/lex/tokens.go.tmp pkg/sql/lex/tokens.go go install -v ./pkg/cmd/prereqs can't load package: package ./pkg/cmd/prereqs: cannot find package "." in:
Don't run make, just import it like the example.
make
I also added another example and a handy AstWalker. See walk.go
AstWalker
(echo "// Code generated by goyacc. DO NOT EDIT."; \ echo "// GENERATED FILE DO NOT EDIT"; \ cat pkg/sql/parser/gen/sql.go.tmp | \ sed -E 's/^const ([A-Z][_A-Z0-9]) =.$/const \1 = lex.\1/g') > pkg/sql/parser/sql.go.tmp || rm pkg/sql/parser/sql.go.tmp mv -f pkg/sql/parser/sql.go.tmp pkg/sql/parser/sql.go goimports -w pkg/sql/parser/sql.go (echo "// Code generated by make. DO NOT EDIT."; \ echo "// GENERATED FILE DO NOT EDIT"; \ echo; \ echo "package lex"; \ echo; \ grep '^const [A-Z][_A-Z0-9]* ' pkg/sql/parser/gen/sql.go.tmp) > pkg/sql/lex/tokens.go.tmp || rm pkg/sql/lex/tokens.go.tmp mv -f pkg/sql/lex/tokens.go.tmp pkg/sql/lex/tokens.go go install -v ./pkg/cmd/prereqs can't load package: package ./pkg/cmd/prereqs: cannot find package "." in: