mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 10:31:59 +00:00
tstest/integration: generate deps for all platforms in deps generator
We have different deps depending on the platform. If we pick a privileged platform, we'll miss some deps. If we use the union of all platforms, the integration test won't compile on some platforms, because it'll import packages that don't compile on that platform. Give in to the madness and give each platform its own deps file. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
committed by
Josh Bleecher Snyder
parent
41d06bdf86
commit
4b1f2ae382
@@ -12,16 +12,25 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func main() {
|
||||
for _, goos := range []string{"windows", "linux", "darwin", "freebsd", "openbsd"} {
|
||||
generate(goos)
|
||||
}
|
||||
}
|
||||
|
||||
func generate(goos string) {
|
||||
var x struct {
|
||||
Imports []string
|
||||
}
|
||||
j, err := exec.Command("go", "list", "-json", "tailscale.com/cmd/tailscaled").Output()
|
||||
cmd := exec.Command("go", "list", "-json", "tailscale.com/cmd/tailscaled")
|
||||
cmd.Env = append(os.Environ(), "GOOS="+goos, "GOARCH=amd64")
|
||||
j, err := cmd.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatalf("GOOS=%s GOARCH=amd64 %s: %v", goos, cmd, err)
|
||||
}
|
||||
if err := json.Unmarshal(j, &x); err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -46,7 +55,8 @@ import (
|
||||
}
|
||||
fmt.Fprintf(&out, ")\n")
|
||||
|
||||
err = ioutil.WriteFile("tailscaled_deps_test.go", out.Bytes(), 0644)
|
||||
filename := fmt.Sprintf("tailscaled_deps_test_%s.go", goos)
|
||||
err = ioutil.WriteFile(filename, out.Bytes(), 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user