cmd/tailscaled, ipn/localapi, util/eventbus: don't link in regexp when debug is omitted

Saves 442 KB. Lock it with a new min test.

Updates #12614

Change-Id: Ia7bf6f797b6cbf08ea65419ade2f359d390f8e91
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-09-30 11:54:16 -07:00
committed by Brad Fitzpatrick
parent 840c7668e2
commit 9386a101d8
11 changed files with 100 additions and 78 deletions
+42 -13
View File
@@ -4,9 +4,12 @@
package main
import (
"maps"
"slices"
"strings"
"testing"
"tailscale.com/feature/featuretags"
"tailscale.com/tstest/deptest"
)
@@ -90,19 +93,6 @@ func TestOmitDrive(t *testing.T) {
}.Check(t)
}
func TestOmitTailnetLock(t *testing.T) {
deptest.DepChecker{
GOOS: "linux",
GOARCH: "amd64",
Tags: "ts_omit_tailnetlock,ts_include_cli",
OnDep: func(dep string) {
if strings.Contains(dep, "cbor") {
t.Errorf("unexpected dep with ts_omit_tailnetlock: %q", dep)
}
},
}.Check(t)
}
func TestOmitPortmapper(t *testing.T) {
deptest.DepChecker{
GOOS: "linux",
@@ -235,3 +225,42 @@ func TestOmitUseProxy(t *testing.T) {
},
}.Check(t)
}
func minTags() string {
var tags []string
for _, f := range slices.Sorted(maps.Keys(featuretags.Features)) {
if f.IsOmittable() {
tags = append(tags, f.OmitTag())
}
}
return strings.Join(tags, ",")
}
func TestMinTailscaledNoCLI(t *testing.T) {
deptest.DepChecker{
GOOS: "linux",
GOARCH: "amd64",
Tags: minTags(),
OnDep: func(dep string) {
if strings.Contains(dep, "regexp") {
t.Errorf("unexpected dep: %q", dep)
}
if strings.Contains(dep, "cbor") {
t.Errorf("unexpected dep: %q", dep)
}
},
}.Check(t)
}
func TestMinTailscaledWithCLI(t *testing.T) {
deptest.DepChecker{
GOOS: "linux",
GOARCH: "amd64",
Tags: minTags() + ",ts_include_cli",
OnDep: func(dep string) {
if strings.Contains(dep, "cbor") {
t.Errorf("unexpected dep: %q", dep)
}
},
}.Check(t)
}