Implement func mapper for parser reflection
This commit is contained in:
9
Makefile
9
Makefile
@ -2,6 +2,7 @@
|
||||
CLIENT_PKG := ./cmd/eia-client
|
||||
CLIENT_GEN_FILE := ./api/eiaapi.gen.go
|
||||
GO_FORMATTER := gofumpt
|
||||
IS_GNU_SED := $(shell sed --version >/dev/null 2>&1 && echo true || echo false)
|
||||
|
||||
.PHONY: all generate build install clean
|
||||
|
||||
@ -11,9 +12,15 @@ all: generate build
|
||||
# Generate code
|
||||
generate:
|
||||
go generate ./...
|
||||
# Fix errors in generated code
|
||||
ifeq ($(IS_GNU_SED), true)
|
||||
# Fix errors in generated code with GNU sed
|
||||
sed -E -i 's/Total[[:space:]]+\*int/Total *string/g' $(CLIENT_GEN_FILE)
|
||||
sed -E -i 's/Command[[:space:]]+\*\[\]string/Command *string/g' $(CLIENT_GEN_FILE)
|
||||
else
|
||||
# Fix errors in generated code with BSD sed
|
||||
sed -E -i '' 's/Total[[:space:]]+\*int/Total *string/g' $(CLIENT_GEN_FILE)
|
||||
sed -E -i '' 's/Command[[:space:]]+\*\[\]string/Command *string/g' $(CLIENT_GEN_FILE)
|
||||
endif
|
||||
# Pretty it up
|
||||
$(GO_FORMATTER) -w $(CLIENT_GEN_FILE)
|
||||
|
||||
|
Reference in New Issue
Block a user