github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/util/log/eventpb/eventpbgen/extract_log_channels.awk (about) 1 # extract_log_channels.awk builds a go file in package main with a 2 # map[string]struct{} containing entries corresponding to the members of the 3 # protobuf enum Channel. 4 5 BEGIN { 6 inside_enum = 0 7 print ("// Code generated by gen.go. DO NOT EDIT.\n") 8 print ("package main\n") 9 print ("var channels = map[string]struct{}{") 10 } 11 12 $0 ~ /^enum Channel \{/ { 13 inside_enum = 1 14 } 15 16 inside_enum && $1 ~ /[A-Z]+/ { 17 printf "\t\"%s\": {},\n", $1 18 } 19 20 inside_enum && $0 == "}" { 21 print("}") 22 inside_enum = 0 23 } 24