cmd/tailscale: remove dep on clientupdate package if feature is omitted

We already had a featuretag for clientupdate, but the CLI wasn't using
it, making the "minbox" build (minimal combined tailscaled + CLI
build) larger than necessary.

Updates #12614

Change-Id: Idd7546c67dece7078f25b8f2ae9886f58d599002
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-02-04 10:30:55 -08:00
committed by Brad Fitzpatrick
parent 569caefeb5
commit 40cd54daf7
5 changed files with 29 additions and 14 deletions

View File

@@ -219,6 +219,7 @@ func noDupFlagify(c *ffcli.Command) {
maybeFunnelCmd,
maybeServeCmd,
maybeCertCmd,
maybeUpdateCmd,
_ func() *ffcli.Command
)
@@ -270,7 +271,7 @@ func newRootCmd() *ffcli.Command {
nilOrCall(maybeNetlockCmd),
licensesCmd,
exitNodeCmd(),
updateCmd,
nilOrCall(maybeUpdateCmd),
whoisCmd,
debugCmd(),
nilOrCall(maybeDriveCmd),

View File

@@ -1,6 +1,8 @@
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
//go:build !ts_omit_clientupdate
package cli
import (
@@ -17,6 +19,14 @@
"tailscale.com/version/distro"
)
func init() {
maybeUpdateCmd = func() *ffcli.Command { return updateCmd }
clientupdateLatestTailscaleVersion.Set(func() (string, error) {
return clientupdate.LatestTailscaleVersion(clientupdate.CurrentTrack)
})
}
var updateCmd = &ffcli.Command{
Name: "update",
ShortUsage: "tailscale update",

View File

@@ -10,7 +10,7 @@
"fmt"
"github.com/peterbourgon/ff/v3/ffcli"
"tailscale.com/clientupdate"
"tailscale.com/feature"
"tailscale.com/ipn/ipnstate"
"tailscale.com/version"
)
@@ -35,6 +35,8 @@
upstream bool
}
var clientupdateLatestTailscaleVersion feature.Hook[func() (string, error)]
func runVersion(ctx context.Context, args []string) error {
if len(args) > 0 {
return fmt.Errorf("too many non-flag arguments: %q", args)
@@ -51,7 +53,11 @@ func runVersion(ctx context.Context, args []string) error {
var upstreamVer string
if versionArgs.upstream {
upstreamVer, err = clientupdate.LatestTailscaleVersion(clientupdate.CurrentTrack)
f, ok := clientupdateLatestTailscaleVersion.GetOk()
if !ok {
return fmt.Errorf("fetching latest version not supported in this build")
}
upstreamVer, err = f()
if err != nil {
return err
}

View File

@@ -1,7 +1,5 @@
tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/depaware)
filippo.io/edwards25519 from github.com/hdevalence/ed25519consensus
filippo.io/edwards25519/field from filippo.io/edwards25519
github.com/gaissmai/bart from tailscale.com/net/ipset+
github.com/gaissmai/bart/internal/bitset from github.com/gaissmai/bart+
github.com/gaissmai/bart/internal/sparse from github.com/gaissmai/bart
@@ -12,7 +10,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
github.com/go-json-experiment/json/internal/jsonwire from github.com/go-json-experiment/json+
github.com/go-json-experiment/json/jsontext from github.com/go-json-experiment/json+
github.com/golang/groupcache/lru from tailscale.com/net/dnscache
github.com/hdevalence/ed25519consensus from tailscale.com/clientupdate/distsign
💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/netmon
github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink
github.com/kballard/go-shellquote from tailscale.com/cmd/tailscale/cli
@@ -50,8 +47,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
tailscale.com/client/local from tailscale.com/client/tailscale+
tailscale.com/client/tailscale from tailscale.com/internal/client/tailscale
tailscale.com/client/tailscale/apitype from tailscale.com/ipn/ipnauth+
tailscale.com/clientupdate from tailscale.com/cmd/tailscale/cli
tailscale.com/clientupdate/distsign from tailscale.com/clientupdate
tailscale.com/cmd/tailscale/cli from tailscale.com/cmd/tailscaled
tailscale.com/cmd/tailscale/cli/ffcomplete from tailscale.com/cmd/tailscale/cli
tailscale.com/cmd/tailscale/cli/ffcomplete/internal from tailscale.com/cmd/tailscale/cli/ffcomplete
@@ -175,7 +170,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
tailscale.com/util/clientmetric from tailscale.com/appc+
tailscale.com/util/cloudenv from tailscale.com/hostinfo+
tailscale.com/util/cloudinfo from tailscale.com/wgengine/magicsock
tailscale.com/util/cmpver from tailscale.com/clientupdate
tailscale.com/util/ctxkey from tailscale.com/client/tailscale/apitype+
tailscale.com/util/dnsname from tailscale.com/appc+
tailscale.com/util/eventbus from tailscale.com/client/local+
@@ -268,7 +262,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
vendor/golang.org/x/text/transform from vendor/golang.org/x/text/secure/bidirule+
vendor/golang.org/x/text/unicode/bidi from vendor/golang.org/x/net/idna+
vendor/golang.org/x/text/unicode/norm from vendor/golang.org/x/net/idna
archive/tar from tailscale.com/clientupdate
bufio from compress/flate+
bytes from bufio+
cmp from encoding/json+
@@ -428,7 +421,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
path from io/fs+
path/filepath from crypto/x509+
reflect from crypto/x509+
regexp from tailscale.com/clientupdate+
regexp from tailscale.com/cmd/tailscale/cli
regexp/syntax from regexp
runtime from crypto/internal/fips140+
runtime/debug from github.com/klauspost/compress/zstd+

View File

@@ -285,9 +285,14 @@ func TestMinTailscaledWithCLI(t *testing.T) {
}
},
BadDeps: map[string]string{
"golang.org/x/net/http2": "unexpected x/net/http2 dep; tailscale/tailscale#17305",
"expvar": "unexpected expvar dep",
"github.com/mdlayher/genetlink": "unexpected genetlink dep",
"golang.org/x/net/http2": "unexpected x/net/http2 dep; tailscale/tailscale#17305",
"expvar": "unexpected expvar dep",
"github.com/mdlayher/genetlink": "unexpected genetlink dep",
"tailscale.com/clientupdate": "unexpected clientupdate dep",
"filippo.io/edwards25519": "unexpected edwards25519 dep",
"github.com/hdevalence/ed25519consensus": "unexpected ed25519consensus dep",
"tailscale.com/clientupdate/distsign": "unexpected distsign dep",
"archive/tar": "unexpected archive/tar dep",
},
}.Check(t)
}