all: fix golangci-lint errors

These erroneously blocked a recent PR, which I fixed by simply
re-running CI. But we might as well fix them anyway.
These are mostly `printf` to `print` and a couple of `!=` to `!Equal()`

Updates #cleanup

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris 2025-01-06 16:34:27 -08:00 committed by Will Norris
parent de9d4b2f88
commit 60daa2adb8
8 changed files with 13 additions and 13 deletions

View File

@ -18,12 +18,12 @@ var (
) )
func usage() { func usage() {
fmt.Fprintf(os.Stderr, ` fmt.Fprint(os.Stderr, `
usage: addlicense -file FILE <subcommand args...> usage: addlicense -file FILE <subcommand args...>
`[1:]) `[1:])
flag.PrintDefaults() flag.PrintDefaults()
fmt.Fprintf(os.Stderr, ` fmt.Fprint(os.Stderr, `
addlicense adds a Tailscale license to the beginning of file. addlicense adds a Tailscale license to the beginning of file.
It is intended for use with 'go generate', so it also runs a subcommand, It is intended for use with 'go generate', so it also runs a subcommand,

View File

@ -311,7 +311,7 @@ func (h *apiserverProxy) addImpersonationHeadersAsRequired(r *http.Request) {
// Now add the impersonation headers that we want. // Now add the impersonation headers that we want.
if err := addImpersonationHeaders(r, h.log); err != nil { if err := addImpersonationHeaders(r, h.log); err != nil {
log.Printf("failed to add impersonation headers: " + err.Error()) log.Print("failed to add impersonation headers: ", err.Error())
} }
} }

View File

@ -77,7 +77,7 @@ func presentRiskToUser(riskType, riskMessage, acceptedRisks string) error {
for left := riskAbortTimeSeconds; left > 0; left-- { for left := riskAbortTimeSeconds; left > 0; left-- {
msg := fmt.Sprintf("\rContinuing in %d seconds...", left) msg := fmt.Sprintf("\rContinuing in %d seconds...", left)
msgLen = len(msg) msgLen = len(msg)
printf(msg) printf("%s", msg)
select { select {
case <-interrupt: case <-interrupt:
printf("\r%s\r", strings.Repeat("x", msgLen+1)) printf("\r%s\r", strings.Repeat("x", msgLen+1))

View File

@ -53,12 +53,12 @@ func main() {
} }
func usage() { func usage() {
fmt.Fprintf(os.Stderr, ` fmt.Fprint(os.Stderr, `
usage: tsconnect {dev|build|serve} usage: tsconnect {dev|build|serve}
`[1:]) `[1:])
flag.PrintDefaults() flag.PrintDefaults()
fmt.Fprintf(os.Stderr, ` fmt.Fprint(os.Stderr, `
tsconnect implements development/build/serving workflows for Tailscale Connect. tsconnect implements development/build/serving workflows for Tailscale Connect.
It can be invoked with one of three subcommands: It can be invoked with one of three subcommands:

View File

@ -47,7 +47,7 @@ func synologyProxyFromConfigCached(req *http.Request) (*url.URL, error) {
var err error var err error
modtime := mtime(synologyProxyConfigPath) modtime := mtime(synologyProxyConfigPath)
if modtime != cache.updated { if !modtime.Equal(cache.updated) {
cache.httpProxy, cache.httpsProxy, err = synologyProxiesFromConfig() cache.httpProxy, cache.httpsProxy, err = synologyProxiesFromConfig()
cache.updated = modtime cache.updated = modtime
} }

View File

@ -41,7 +41,7 @@ func TestSynologyProxyFromConfigCached(t *testing.T) {
t.Fatalf("got %s, %v; want nil, nil", val, err) t.Fatalf("got %s, %v; want nil, nil", val, err)
} }
if got, want := cache.updated, time.Unix(0, 0); got != want { if got, want := cache.updated.UTC(), time.Unix(0, 0).UTC(); !got.Equal(want) {
t.Fatalf("got %s, want %s", got, want) t.Fatalf("got %s, want %s", got, want)
} }
if cache.httpProxy != nil { if cache.httpProxy != nil {

View File

@ -1014,10 +1014,10 @@ func (ss *sshSession) startWithStdPipes() (err error) {
func envForUser(u *userMeta) []string { func envForUser(u *userMeta) []string {
return []string{ return []string{
fmt.Sprintf("SHELL=" + u.LoginShell()), fmt.Sprintf("SHELL=%s", u.LoginShell()),
fmt.Sprintf("USER=" + u.Username), fmt.Sprintf("USER=%s", u.Username),
fmt.Sprintf("HOME=" + u.HomeDir), fmt.Sprintf("HOME=%s", u.HomeDir),
fmt.Sprintf("PATH=" + defaultPathForUser(&u.User)), fmt.Sprintf("PATH=%s", defaultPathForUser(&u.User)),
} }
} }

View File

@ -955,7 +955,7 @@ func (s *Server) MapResponse(req *tailcfg.MapRequest) (res *tailcfg.MapResponse,
if dns != nil && s.MagicDNSDomain != "" { if dns != nil && s.MagicDNSDomain != "" {
dns = dns.Clone() dns = dns.Clone()
dns.CertDomains = []string{ dns.CertDomains = []string{
fmt.Sprintf(node.Hostinfo.Hostname() + "." + s.MagicDNSDomain), node.Hostinfo.Hostname() + "." + s.MagicDNSDomain,
} }
} }