Source file src/cmd/compile/internal/test/dep_test.go

     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 test
     6  
     7  import (
     8  	"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}}", "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/scanner":
    22  			// cmd/compile/internal/importer introduces a dependency
    23  			// on go/build and go/token; cmd/compile/internal/ uses
    24  			// go/constant which uses go/token in its API. Once we
    25  			// got rid of those dependencies, enable this check again.
    26  			// TODO(gri) fix this
    27  			// t.Errorf("undesired dependency on %q", dep)
    28  		}
    29  	}
    30  }
    31  

View as plain text