all: use cmpx.Or where it made sense

I left a few out where writing it explicitly was better
for various reasons.

Updates #8296

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-06-07 19:46:59 -07:00
committed by Brad Fitzpatrick
parent 699996ad6c
commit eefee6f149
16 changed files with 35 additions and 69 deletions

View File

@@ -16,6 +16,7 @@ import (
"testing"
"tailscale.com/ipn"
"tailscale.com/util/cmpx"
)
func TestExpandProxyArg(t *testing.T) {
@@ -140,10 +141,7 @@ func TestGetServeHandler(t *testing.T) {
},
TLS: &tls.ConnectionState{ServerName: serverName},
}
port := tt.port
if port == 0 {
port = 443
}
port := cmpx.Or(tt.port, 443)
req = req.WithContext(context.WithValue(req.Context(), serveHTTPContextKey{}, &serveHTTPContext{
DestPort: port,
}))