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:
committed by
Brad Fitzpatrick
parent
569caefeb5
commit
40cd54daf7
@@ -219,6 +219,7 @@ var (
|
|||||||
maybeFunnelCmd,
|
maybeFunnelCmd,
|
||||||
maybeServeCmd,
|
maybeServeCmd,
|
||||||
maybeCertCmd,
|
maybeCertCmd,
|
||||||
|
maybeUpdateCmd,
|
||||||
_ func() *ffcli.Command
|
_ func() *ffcli.Command
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ change in the future.
|
|||||||
nilOrCall(maybeNetlockCmd),
|
nilOrCall(maybeNetlockCmd),
|
||||||
licensesCmd,
|
licensesCmd,
|
||||||
exitNodeCmd(),
|
exitNodeCmd(),
|
||||||
updateCmd,
|
nilOrCall(maybeUpdateCmd),
|
||||||
whoisCmd,
|
whoisCmd,
|
||||||
debugCmd(),
|
debugCmd(),
|
||||||
nilOrCall(maybeDriveCmd),
|
nilOrCall(maybeDriveCmd),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) Tailscale Inc & contributors
|
// Copyright (c) Tailscale Inc & contributors
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build !ts_omit_clientupdate
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -17,6 +19,14 @@ import (
|
|||||||
"tailscale.com/version/distro"
|
"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{
|
var updateCmd = &ffcli.Command{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
ShortUsage: "tailscale update",
|
ShortUsage: "tailscale update",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/peterbourgon/ff/v3/ffcli"
|
"github.com/peterbourgon/ff/v3/ffcli"
|
||||||
"tailscale.com/clientupdate"
|
"tailscale.com/feature"
|
||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
"tailscale.com/version"
|
"tailscale.com/version"
|
||||||
)
|
)
|
||||||
@@ -35,6 +35,8 @@ var versionArgs struct {
|
|||||||
upstream bool
|
upstream bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clientupdateLatestTailscaleVersion feature.Hook[func() (string, error)]
|
||||||
|
|
||||||
func runVersion(ctx context.Context, args []string) error {
|
func runVersion(ctx context.Context, args []string) error {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
return fmt.Errorf("too many non-flag arguments: %q", args)
|
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
|
var upstreamVer string
|
||||||
if versionArgs.upstream {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/depaware)
|
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 from tailscale.com/net/ipset+
|
||||||
github.com/gaissmai/bart/internal/bitset from github.com/gaissmai/bart+
|
github.com/gaissmai/bart/internal/bitset from github.com/gaissmai/bart+
|
||||||
github.com/gaissmai/bart/internal/sparse 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/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/go-json-experiment/json/jsontext from github.com/go-json-experiment/json+
|
||||||
github.com/golang/groupcache/lru from tailscale.com/net/dnscache
|
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 from tailscale.com/net/netmon
|
||||||
github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink
|
github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink
|
||||||
github.com/kballard/go-shellquote from tailscale.com/cmd/tailscale/cli
|
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/local from tailscale.com/client/tailscale+
|
||||||
tailscale.com/client/tailscale from tailscale.com/internal/client/tailscale
|
tailscale.com/client/tailscale from tailscale.com/internal/client/tailscale
|
||||||
tailscale.com/client/tailscale/apitype from tailscale.com/ipn/ipnauth+
|
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 from tailscale.com/cmd/tailscaled
|
||||||
tailscale.com/cmd/tailscale/cli/ffcomplete from tailscale.com/cmd/tailscale/cli
|
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
|
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/clientmetric from tailscale.com/appc+
|
||||||
tailscale.com/util/cloudenv from tailscale.com/hostinfo+
|
tailscale.com/util/cloudenv from tailscale.com/hostinfo+
|
||||||
tailscale.com/util/cloudinfo from tailscale.com/wgengine/magicsock
|
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/ctxkey from tailscale.com/client/tailscale/apitype+
|
||||||
tailscale.com/util/dnsname from tailscale.com/appc+
|
tailscale.com/util/dnsname from tailscale.com/appc+
|
||||||
tailscale.com/util/eventbus from tailscale.com/client/local+
|
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/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/bidi from vendor/golang.org/x/net/idna+
|
||||||
vendor/golang.org/x/text/unicode/norm 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+
|
bufio from compress/flate+
|
||||||
bytes from bufio+
|
bytes from bufio+
|
||||||
cmp from encoding/json+
|
cmp from encoding/json+
|
||||||
@@ -428,7 +421,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
|
|||||||
path from io/fs+
|
path from io/fs+
|
||||||
path/filepath from crypto/x509+
|
path/filepath from crypto/x509+
|
||||||
reflect from crypto/x509+
|
reflect from crypto/x509+
|
||||||
regexp from tailscale.com/clientupdate+
|
regexp from tailscale.com/cmd/tailscale/cli
|
||||||
regexp/syntax from regexp
|
regexp/syntax from regexp
|
||||||
runtime from crypto/internal/fips140+
|
runtime from crypto/internal/fips140+
|
||||||
runtime/debug from github.com/klauspost/compress/zstd+
|
runtime/debug from github.com/klauspost/compress/zstd+
|
||||||
|
|||||||
@@ -285,9 +285,14 @@ func TestMinTailscaledWithCLI(t *testing.T) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
BadDeps: map[string]string{
|
BadDeps: map[string]string{
|
||||||
"golang.org/x/net/http2": "unexpected x/net/http2 dep; tailscale/tailscale#17305",
|
"golang.org/x/net/http2": "unexpected x/net/http2 dep; tailscale/tailscale#17305",
|
||||||
"expvar": "unexpected expvar dep",
|
"expvar": "unexpected expvar dep",
|
||||||
"github.com/mdlayher/genetlink": "unexpected genetlink 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)
|
}.Check(t)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user