openconfig / gnoigo

Go library implementing a gNOI client
Apache License 2.0
4 stars 5 forks source link

gnoigo.Execute() usage #21

Closed asafsonnv closed 8 months ago

asafsonnv commented 9 months ago

Hi,

Thanks for this great project. It simplifies our work a lot. The code is pretty clear but I have an issue when trying to call gnoigo.Execute().

I followed your example in the README and I got an error. my code is:

conn, err := grpc.DialContext(ctx, serverAddress, opts)
if err != nil {
    log.Fatalf("failed to dial server: %v", err)
}
defer conn.Close()

clients := gnoigo.NewClients(conn)
rebootStatusOp := spb.NewRebootStatusOperation()
response, err := gnoigo.Execute(ctx, clients, rebootStatusOp) --------> Error is here
fmt.Println(response, err)

the error is: type *"github.com/openconfig/gnoigo/system".RebootStatusOperation of rebootStatusOp does not match gnoigo.Operation[T] (cannot infer T)

how can I overcome this issue?

Thanks in advance, Asaf.

greg-dennis commented 9 months ago

What version of Go are you using?

asafsonnv commented 8 months ago

go version go1.20.13 linux/amd64

greg-dennis commented 8 months ago

Ah, it requires 1.21 for the improved generics inference. I see the go.mod file is behind. I'll fix that.