forked from gopcua/opcua
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.sh
executable file
·26 lines (19 loc) · 745 Bytes
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
rm -f */*_gen.go
go run cmd/id/main.go
go run cmd/status/main.go
go run cmd/service/*.go
go run cmd/stats/*.go
# install stringer if not installed already
command -v stringer || go get -u golang.org/x/tools/cmd/stringer
# find all enum types
enums=$(grep -w '^type' ua/enums*.go | awk '{print $2;}' | paste -sd, -)
# generate enum string method
(cd ua && stringer -type $enums -output enums_strings_gen.go)
echo "Wrote ua/enums_strings_gen.go"
stringer -type ConnState -output connstate_strings_gen.go
echo "Wrote connstate_strings_gen.go"
(cd stats && stringer -type Metric -output metrics_strings_gen.go)
echo "Wrote stats/metrics_strings_gen.go"
# remove golang.org/x/tools/cmd/stringer from list of dependencies
go mod tidy