openziti / sdk-golang

Ziti SDK for Golang
Apache License 2.0
100 stars 16 forks source link

zping example not compiling #641

Closed formula349 closed 4 days ago

formula349 commented 1 month ago

Cloned the sdk repo on a linux machine. Tried running the steps in the README and always end up with this error. This is a 'go run', but the same happened with 'go install', which only worked after a 'go mod init zping' and 'go mod tidy'.

Is this example just too old to be run with current version of go?   `formula349@dev1:~/zitiapps/sdk-golang/example/zping$ go run .

github.com/openziti/transport/v2/proxies

../../../../go/pkg/mod/github.com/openziti/transport/v2@v2.0.146/proxies/http_connect.go:60:20: pfxlog.Logger().WithError undefined (type pfxlog.Builder has no field or method WithError)

github.com/openziti/identity/engines/parsec

../../../../go/pkg/mod/github.com/openziti/identity@v1.0.85/engines/parsec/parsec_engine.go:21:18: undefined: pfxlog.ContextLogger

github.com/openziti/sdk-golang/ziti/edge/posture

../../../../go/pkg/mod/github.com/openziti/sdk-golang@v0.23.44/ziti/edge/posture/cache.go:119:26: cannot use err (variable of type []error) as string value in argument to pfxlog.Logger().Error f`

dovholuknf commented 1 month ago

I'll take a peek

dovholuknf commented 1 month ago

Ok, I didn't use the README on purpose just to see if it'd build how I normally do things and it does. I ran:

cd /tmp
git clone git@github.com:openziti/sdk-golang.git
cd sdk-golang/example/zping
go build ./...

After that, zping seems to work just fine:

./zping
zping replaces the function of icmp ping tool in a ziti network.
It provides an end to end latency measurement between any two ziti identities in
a ziti network and like icmp ping will provide the following metrics upon completion
of the ping session: min, max and mean latency and standard deviation as well as % loss.
zping uses the addressable terminator function of ziti to direct ping requests to
specific ziti identities.

Usage:
  zping [command]

Available Commands:
  client      zping client command
  completion  Generate the autocompletion script for the specified shell
  enroll      Enroll an identity
  help        Help about any command
  server      zping server command

Flags:
  -h, --help   help for zping

Use "zping [command] --help" for more information about a command.

I'd say we probably just need to make the readme better.

dovholuknf commented 1 month ago

See how this readme works for you:

https://github.com/openziti/sdk-golang/blob/80fc872ba68715da479bbfb2f03c632987272c85/example/zping/README.md

formula349 commented 1 month ago

Ok I removed the go.mod and go.sum that I created with go mod init and now I can build and run it. The go mod init was done because go install wouldn't work... Thank you.

dovholuknf commented 1 month ago

cool. i'll close this issue then when the pr merges