github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/compile/internal/gc/dep_test.go (about)

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package gc
     6  
     7  import (
     8  	"github.com/gagliardetto/golang-go/not-internal/testenv"
     9  	"os/exec"
    10  	"strings"
    11  	"testing"
    12  )
    13  
    14  func TestDeps(t *testing.T) {
    15  	out, err := exec.Command(testenv.GoToolPath(t), "list", "-f", "{{.Deps}}", "github.com/gagliardetto/golang-go/cmd/compile/internal/gc").Output()
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  	for _, dep := range strings.Fields(strings.Trim(string(out), "[]")) {
    20  		switch dep {
    21  		case "go/build", "go/token":
    22  			t.Errorf("undesired dependency on %q", dep)
    23  		}
    24  	}
    25  }