Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the schema to v1.05.02-2022-11-01 and regenerate code #589

Merged
merged 10 commits into from
Jun 13, 2023
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install-py-opcua:
pip3 install opcua

gen:
go get -d golang.org/x/tools/cmd/stringer
go install golang.org/x/tools/cmd/stringer@latest
go generate ./...
go mod tidy

Expand Down
3 changes: 3 additions & 0 deletions cmd/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ import "time"
func Enums(dict *TypeDictionary) []Type {
var enums []Type
for _, t := range dict.Enums {
if len(t.Values) == 0 {
continue
}
e := Type{
Name: goname.Format(t.Name),
Kind: KindEnum,
Expand Down
5 changes: 1 addition & 4 deletions cmd/status/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ func (n StatusCode) Error() string {

var (
StatusOK StatusCode = 0x0
StatusUncertain StatusCode = 0x40000000
StatusBad StatusCode = 0x80000000

{{range .}}{{index . 0}} StatusCode = {{index . 1}}
{{end}}
)
Expand All @@ -111,7 +108,7 @@ var StatusCodes = map[StatusCode]StatusCodeDesc{
StatusOK: {Name: "OK", Text: ""},
StatusUncertain: {Name: "Uncertain", Text: ""},
StatusBad: {Name: "Bad", Text: ""},
{{range .}}{{index . 0}}: { Name: "{{index . 0}}", Text: "{{index . 2}}" },
{{range .}}{{index . 0}}: { Name: "{{index . 0}}", Text: {{index . 2}} },
{{end}}
}
`))
4 changes: 2 additions & 2 deletions examples/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"syscall"
"time"

"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"

"github.com/gopcua/opcua"
"github.com/gopcua/opcua/debug"
Expand Down Expand Up @@ -271,7 +271,7 @@ func authFromFlags(cert []byte) (ua.UserTokenType, opcua.Option) {

if passPrompt {
fmt.Print("Enter password: ")
passInput, err := terminal.ReadPassword(int(syscall.Stdin))
passInput, err := term.ReadPassword(int(syscall.Stdin))
if err != nil {
log.Fatalf("Error reading password: %s", err)
}
Expand Down
6 changes: 1 addition & 5 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ 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
command -v stringer || go install golang.org/x/tools/cmd/stringer@latest

# find all enum types
enums=$(grep -w '^type' ua/enums*.go | awk '{print $2;}' | paste -sd, -)
Expand All @@ -19,8 +18,5 @@ 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
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ go 1.20
require (
github.com/pascaldekloe/goe v0.1.1
github.com/pkg/errors v0.9.1
golang.org/x/crypto v0.9.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/term v0.8.0
)

require (
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
)
require golang.org/x/sys v0.8.0 // indirect

retract (
v0.2.5 // https://github.com/gopcua/opcua/issues/538
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/pascaldekloe/goe v0.1.1 h1:Ah6WQ56rZONR3RW3qWa2NCZ6JAVvSpUcoLBaOmYFt9
github.com/pascaldekloe/goe v0.1.1/go.mod h1:KSyfaxQOh0HZPjDP1FL/kFtbqYqrALJTaMafFUIccqU=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
Expand Down
41,096 changes: 30,356 additions & 10,740 deletions id/id_gen.go

Large diffs are not rendered by default.

9,874 changes: 9,841 additions & 33 deletions schema/NodeIds.csv

Large diffs are not rendered by default.