all: use IsZero methods

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
pull/800/head
Josh Bleecher Snyder 4 years ago
parent c8f257df00
commit efb08e4fee

@ -249,7 +249,7 @@ func (c *Direct) TryLogout(ctx context.Context) error {
// TODO(crawshaw): Tell the server. This node key should be // TODO(crawshaw): Tell the server. This node key should be
// immediately invalidated. // immediately invalidated.
//if c.persist.PrivateNodeKey != (wgcfg.PrivateKey{}) { //if !c.persist.PrivateNodeKey.IsZero() {
//} //}
c.persist = Persist{ c.persist = Persist{
PrivateMachineKey: c.persist.PrivateMachineKey, PrivateMachineKey: c.persist.PrivateMachineKey,
@ -335,7 +335,7 @@ func (c *Direct) doLogin(ctx context.Context, t *oauth2.Token, flags LoginFlags,
// Try refreshing the current key first // Try refreshing the current key first
tryingNewKey = persist.PrivateNodeKey tryingNewKey = persist.PrivateNodeKey
} }
if persist.OldPrivateNodeKey != (wgcfg.PrivateKey{}) { if !persist.OldPrivateNodeKey.IsZero() {
oldNodeKey = persist.OldPrivateNodeKey.Public() oldNodeKey = persist.OldPrivateNodeKey.Public()
} }

@ -356,7 +356,7 @@ func New(collection string) *Policy {
newc.PrivateID = logtail.PrivateID{} newc.PrivateID = logtail.PrivateID{}
newc.Collection = collection newc.Collection = collection
} }
if newc.PrivateID == (logtail.PrivateID{}) { if newc.PrivateID.IsZero() {
newc.PrivateID, err = logtail.NewPrivateID() newc.PrivateID, err = logtail.NewPrivateID()
if err != nil { if err != nil {
log.Fatalf("logpolicy: NewPrivateID() should never fail") log.Fatalf("logpolicy: NewPrivateID() should never fail")

Loading…
Cancel
Save