cmd/cloner, cmd/viewer: add _test prefix for files generated with the test build tag

Updates #12736

Signed-off-by: Nick Khyl <nickk@tailscale.com>
pull/12785/head
Nick Khyl 4 months ago committed by Nick Khyl
parent 380a3a0834
commit fd0acc4faf

@ -78,7 +78,11 @@ func main() {
w(" return false") w(" return false")
w("}") w("}")
} }
cloneOutput := pkg.Name + "_clone.go" cloneOutput := pkg.Name + "_clone"
if *flagBuildTags == "test" {
cloneOutput += "_test"
}
cloneOutput += ".go"
if err := codegen.WritePackageFile("tailscale.com/cmd/cloner", pkg, cloneOutput, it, buf); err != nil { if err := codegen.WritePackageFile("tailscale.com/cmd/cloner", pkg, cloneOutput, it, buf); err != nil {
log.Fatal(err) log.Fatal(err)
} }

@ -459,7 +459,11 @@ func main() {
} }
genView(buf, it, typ, pkg.Types) genView(buf, it, typ, pkg.Types)
} }
out := pkg.Name + "_view.go" out := pkg.Name + "_view"
if *flagBuildTags == "test" {
out += "_test"
}
out += ".go"
if err := codegen.WritePackageFile("tailscale/cmd/viewer", pkg, out, it, buf); err != nil { if err := codegen.WritePackageFile("tailscale/cmd/viewer", pkg, out, it, buf); err != nil {
log.Fatal(err) log.Fatal(err)
} }

Loading…
Cancel
Save