diff --git a/tstest/integration/gen_deps.go b/tstest/integration/gen_deps.go new file mode 100644 index 000000000..5027d101e --- /dev/null +++ b/tstest/integration/gen_deps.go @@ -0,0 +1,53 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "log" + "os/exec" +) + +func main() { + var x struct { + Imports []string + } + j, err := exec.Command("go", "list", "-json", "tailscale.com/cmd/tailscaled").Output() + if err != nil { + log.Fatal(err) + } + if err := json.Unmarshal(j, &x); err != nil { + log.Fatal(err) + } + var out bytes.Buffer + out.WriteString(`// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by gen_deps.go; DO NOT EDIT. + +package integration + +import ( + // And depend on a bunch of tailscaled innards, for Go's test caching. + // Otherwise cmd/go never sees that we depend on these packages' + // transitive deps when we run "go install tailscaled" in a child + // process and can cache a prior success when a dependency changes. +`) + for _, dep := range x.Imports { + fmt.Fprintf(&out, "\t_ %q\n", dep) + } + fmt.Fprintf(&out, ")\n") + + err = ioutil.WriteFile("tailscaled_deps_test.go", out.Bytes(), 0644) + if err != nil { + log.Fatal(err) + } +} diff --git a/tstest/integration/integration_test.go b/tstest/integration/integration_test.go index 19ef62f13..bd3e01acf 100644 --- a/tstest/integration/integration_test.go +++ b/tstest/integration/integration_test.go @@ -4,6 +4,8 @@ package integration +//go:generate go run gen_deps.go + import ( "bytes" "context" diff --git a/tstest/integration/tailscaled_deps_test.go b/tstest/integration/tailscaled_deps_test.go new file mode 100644 index 000000000..84b35b592 --- /dev/null +++ b/tstest/integration/tailscaled_deps_test.go @@ -0,0 +1,58 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by gen_deps.go; DO NOT EDIT. + +package integration + +import ( + // And depend on a bunch of tailscaled innards, for Go's test caching. + // Otherwise cmd/go never sees that we depend on these packages' + // transitive deps when we run "go install tailscaled" in a child + // process and can cache a prior success when a dependency changes. + _ "context" + _ "crypto/tls" + _ "encoding/json" + _ "errors" + _ "flag" + _ "fmt" + _ "github.com/go-multierror/multierror" + _ "io" + _ "io/ioutil" + _ "log" + _ "net" + _ "net/http" + _ "net/http/httptrace" + _ "net/http/pprof" + _ "net/url" + _ "os" + _ "os/signal" + _ "runtime" + _ "runtime/debug" + _ "strconv" + _ "strings" + _ "syscall" + _ "tailscale.com/derp/derphttp" + _ "tailscale.com/ipn" + _ "tailscale.com/ipn/ipnserver" + _ "tailscale.com/logpolicy" + _ "tailscale.com/net/dns" + _ "tailscale.com/net/interfaces" + _ "tailscale.com/net/socks5/tssocks" + _ "tailscale.com/net/tshttpproxy" + _ "tailscale.com/net/tstun" + _ "tailscale.com/paths" + _ "tailscale.com/tailcfg" + _ "tailscale.com/types/flagtype" + _ "tailscale.com/types/key" + _ "tailscale.com/types/logger" + _ "tailscale.com/util/osshare" + _ "tailscale.com/version" + _ "tailscale.com/version/distro" + _ "tailscale.com/wgengine" + _ "tailscale.com/wgengine/monitor" + _ "tailscale.com/wgengine/netstack" + _ "tailscale.com/wgengine/router" + _ "time" +)