diff --git a/cmd/containerboot/main_test.go b/cmd/containerboot/main_test.go index cd7edea57..6949a7a97 100644 --- a/cmd/containerboot/main_test.go +++ b/cmd/containerboot/main_test.go @@ -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 { diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index c3db722f5..67ca800af 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -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() } diff --git a/ipn/ipnlocal/cert.go b/ipn/ipnlocal/cert.go index d094cc9f8..aa4e2bcc7 100644 --- a/ipn/ipnlocal/cert.go +++ b/ipn/ipnlocal/cert.go @@ -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 } diff --git a/ipn/ipnserver/proxyconnect.go b/ipn/ipnserver/proxyconnect.go index 0a515350d..1094a79f9 100644 --- a/ipn/ipnserver/proxyconnect.go +++ b/ipn/ipnserver/proxyconnect.go @@ -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() diff --git a/ipn/prefs.go b/ipn/prefs.go index 5e8033a28..897547889 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -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 && diff --git a/portlist/portlist_linux.go b/portlist/portlist_linux.go index 68b8ed7ba..94f843746 100644 --- a/portlist/portlist_linux.go +++ b/portlist/portlist_linux.go @@ -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 diff --git a/posture/serialnumber_notmacos.go b/posture/serialnumber_notmacos.go index c1b3e0699..69ad904b8 100644 --- a/posture/serialnumber_notmacos.go +++ b/posture/serialnumber_notmacos.go @@ -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 }