crash if user.Current() returns an error
kjk opened this issue · comments
This happened on a Linux machine.
In:
func NewStructWriter(w io.Writer) *StructWriter {
// Some info for banner.
usr, err := user.Current()
if err != nil {
usr.Name = "an unknown user"
}
If user.Current()
returns an error, usr
is nil
so usr.Name = "foo"
will panic.
It could be sth. like:
userName := "an unknown user"
usr, _ := user.Current()
if usr != nil {
userName = usr.Name
}
Thanks for the suggestion, it should be fixed in 0.1.6.
Thanks, I can confirm it's fixed.
@miku Yes, xmltgo uses zek. Feel free to link to it. I'll also add a link to zek from the website.
@kjk, thanks for putting it online - this can come in handy.
@kjk, hijacking this issue to ask: Can it be that https://www.onlinetool.io/xmltogo/ times out? Does it have a new location?
$ curl -v https://www.onlinetool.io/xmltogo/
Operation timed out after 60000 milliseconds with 0 out of 0 bytes received
@miku sorry about that. my hosting company messed up networking to the server, making it inaccessible.
I've moved the site to a new host. Should be available again when DNS propagates (can take minutes to hours, depending on your DNS provider). Ping me if still doesn't work for you after 24 hrs
@kjk, thanks a lot for the update, will check later.