tailscale-client-go
tailscale-client-go copied to clipboard
Fixup runtime error in client.go
Without a c.init() in the UseOAuth method, BaseURL must be specified, or this code will result in a SIGSEGV on client.go:121 (122 after this commit).
This is one possible way to fix this issue. Alternatively, implementing a NewClient would probably be reasonable too.
@oxtoacart and @mpminardi are discussing this and considering options. The "v2" API design isn't quite nailed down yet and this might change.
Alternatively, implementing a NewClient would probably be reasonable too.
Personally, I like the style of exporting optional things and telling users to stop touching them after initialization. It makes more for a lot less ceremony than c, err := tailscale.NewClient(tailscale.ClientOpts{.....})) or the sea of zero values in tailscale.NewClient(foo, 0, nil, "", 0, nil)
Thanks for calling this out @hosom ! This should be addressed as of https://github.com/tailscale/tailscale-client-go/pull/112 (with https://github.com/tailscale/tailscale-client-go/pull/115 containing a follow-up bugfix).
Our README for the v2 of the client has also been updated to show the new method of configuring OAuth.
@hosom Thanks for bringing this to our attention and proposing a fix. I'm going to close this PR, but please let us know if you run into any lingering issues.