| 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 |
"strings" |
| 10 |
"testing" |
| 11 |
) |
| 12 |
|
| 13 |
func TestDeps(t *testing.T) { |
| 14 |
out, err := testenv.Command(t, testenv.GoToolPath(t), "list", "-f", "{{.Deps}}", "cmd/compile/internal/gc").Output() |
| 15 |
if err != nil { |
| 16 |
t.Fatal(err) |
| 17 |
} |
| 18 |
for _, dep := range strings.Fields(strings.Trim(string(out), "[]")) { |
| 19 |
switch dep { |
| 20 |
case "go/build", "go/scanner": |
| 21 |
// cmd/compile/internal/importer introduces a dependency |
| 22 |
// on go/build and go/token; cmd/compile/internal/ uses |
| 23 |
// go/constant which uses go/token in its API. Once we |
| 24 |
// got rid of those dependencies, enable this check again. |
| 25 |
// TODO(gri) fix this |
| 26 |
// t.Errorf("undesired dependency on %q", dep) |
| 27 |
} |
| 28 |
} |
| 29 |
} |