weird behavior of GetError()
Hey!
I was playing with the API, but I can't get the GetError() to correctly work with my error handling. Here's a quick example:
package main
import (
"fmt"
"gitlab.com/victortoso/qapi-go/pkg/qapi"
)
func main() {
cmd := qapi.QueryVersionCommandReturn{}
fmt.Printf("cmd.Error=%v\n", cmd.Error)
fmt.Printf("cmd.GetError()=%v\n", cmd.GetError())
fmt.Printf("cmd.Error=%T\n", cmd.Error)
fmt.Printf("cmd.GetError()=%T\n", cmd.GetError())
fmt.Printf("cmd.Error==nil => %v\n", nil == cmd.Error)
fmt.Printf("cmd.GetError()==nil => %v\n", nil == cmd.GetError())
fmt.Printf("cmd.Error == cmd.GetError() => %v\n", cmd.Error == cmd.GetError())
}
> go run main.go
cmd.Error=<nil>
cmd.GetError()=<nil>
cmd.Error=*qapi.QapiError
cmd.GetError()=*qapi.QapiError
cmd.Error==nil => true
cmd.GetError()==nil => false
cmd.Error == cmd.GetError() => true
It doesn't make sense for me that cmd.GetError() == cmd.Error but cmd.Error == nil and cmd.GetError() != nil... We have a broken relationship.
I didn't manged to pinpoint what is the underlying issue.
I'm using go 1.20 & gitlab.com/victortoso/qapi-go v0.0.0-20230927104230-5520f9a28086
Btw, thank you for this project, looking forward to get it in the upstream!