zalando / go-keyring

Cross-platform keyring interface for Go
MIT License
815 stars 82 forks source link

Adding fallback for all non-supported platforms #30

Closed diamondburned closed 5 years ago

diamondburned commented 5 years ago

Without this, the app would instantly segfault due to nil pointer. With this, it errors out properly.

szuecs commented 5 years ago

@diamondburned Thanks for your PR!

Can you please: 1) sign DCO (aka git commit -s --ammend) and do a force push ? 2) add maybe a freebsd target if possible to https://github.com/zalando/go-keyring/blob/master/.travis.yml#L4

I am not sure if this change will work for GOOS freebsd. I tried to test it, but it seemed not to work for me:

% GOOS=freebsd go build .                                                                                                                          master
# github.com/godbus/dbus
../../godbus/dbus/transport_unix.go:51:3: cannot use t (type *unixTransport) as type transport in return argument:
        *unixTransport does not implement transport (missing SendNullByte method)
../../godbus/dbus/transport_unix.go:57:3: cannot use t (type *unixTransport) as type transport in return argument:
        *unixTransport does not implement transport (missing SendNullByte method)
diamondburned commented 5 years ago

Before doing those 2, I can only say it works because a friend of mine tested it in a jail. It would simply panic without that, as freebsd seems to match into unix, leading to a crash by a nil pointer dereference. I can't cross-compile from a Linux system because of that same error.

Edit1: A picture of the crash

diamondburned commented 5 years ago

Latest commit does not panic on any non-supported platforms.

szuecs commented 5 years ago

:+1:

mikkeloscar commented 5 years ago

:+1: