mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
all: fix nilness issues
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
c5208f8138
commit
a217f1fccf
@ -999,9 +999,6 @@ func (k *kubeServer) serveSecret(w http.ResponseWriter, r *http.Request) {
|
||||
defer k.Unlock()
|
||||
for k, v := range k.secret {
|
||||
v := base64.StdEncoding.EncodeToString([]byte(v))
|
||||
if err != nil {
|
||||
panic("encode failed")
|
||||
}
|
||||
ret["data"][k] = v
|
||||
}
|
||||
if err := json.NewEncoder(w).Encode(ret); err != nil {
|
||||
|
@ -710,9 +710,6 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
|
||||
c.persist = persist.View()
|
||||
c.mu.Unlock()
|
||||
|
||||
if err != nil {
|
||||
return regen, "", nil, err
|
||||
}
|
||||
if ctx.Err() != nil {
|
||||
return regen, "", nil, ctx.Err()
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ func acmeKey(cs certStore) (crypto.Signer, error) {
|
||||
return nil, errors.New("acme/autocert: invalid account key found in cache")
|
||||
}
|
||||
return parsePrivateKey(priv.Bytes)
|
||||
} else if err != nil && !errors.Is(err, ipn.ErrStateNotExist) {
|
||||
} else if !errors.Is(err, ipn.ErrStateNotExist) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ func (s *Server) handleProxyConnectConn(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
hj, ok := w.(http.Hijacker)
|
||||
if !ok {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
http.Error(w, "CONNECT hijack unavailable", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
c, br, err := hj.Hijack()
|
||||
|
@ -444,8 +444,7 @@ func (p *Prefs) Equals(p2 *Prefs) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
return p != nil && p2 != nil &&
|
||||
p.ControlURL == p2.ControlURL &&
|
||||
return p.ControlURL == p2.ControlURL &&
|
||||
p.RouteAll == p2.RouteAll &&
|
||||
p.AllowSingleHosts == p2.AllowSingleHosts &&
|
||||
p.ExitNodeID == p2.ExitNodeID &&
|
||||
|
@ -178,7 +178,7 @@ func (li *linuxImpl) parseProcNetFile(r *bufio.Reader, fileBase string) error {
|
||||
// Scratch buffer for making inode strings.
|
||||
inoBuf := make([]byte, 0, 50)
|
||||
|
||||
for err == nil {
|
||||
for {
|
||||
line, err := r.ReadSlice('\n')
|
||||
if err == io.EOF {
|
||||
break
|
||||
|
@ -99,13 +99,7 @@ func GetSerialNumbers(logf logger.Logf) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// if there were no serial numbers, check if any errors were
|
||||
// returned and combine them.
|
||||
if len(serials) == 0 && err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logf("got serial numbers %v (errors: %s)", serials, err)
|
||||
logf("got serial numbers %v", serials)
|
||||
|
||||
return serials, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user