mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-04 23:45:34 +00:00
6d82a18916
Causes too much churn for zero benefit. Change-Id: I838f8cdb5723f122f11dd4bbce5e9c07755c3cd9 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
70 lines
1.7 KiB
Go
70 lines
1.7 KiB
Go
// 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.
|
|
|
|
//go:build ignore
|
|
// +build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"log"
|
|
"os"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
for _, goos := range []string{"windows", "linux", "darwin", "freebsd", "openbsd"} {
|
|
generate(goos)
|
|
}
|
|
}
|
|
|
|
func generate(goos string) {
|
|
var x struct {
|
|
Imports []string
|
|
}
|
|
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.Fatalf("GOOS=%s GOARCH=amd64 %s: %v", goos, cmd, 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 {
|
|
if !strings.Contains(dep, ".") {
|
|
// Omit stanard library deps.
|
|
continue
|
|
}
|
|
fmt.Fprintf(&out, "\t_ %q\n", dep)
|
|
}
|
|
fmt.Fprintf(&out, ")\n")
|
|
|
|
filename := fmt.Sprintf("tailscaled_deps_test_%s.go", goos)
|
|
err = ioutil.WriteFile(filename, out.Bytes(), 0644)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|