cue/load: revert: report when "tool" pkg is used in non-tool file
This reverts commit ca66319e39d5af71aa7ea665c3c449dbf9a17d78.
Reason for revert: will use different approach.
Change-Id: Ic0c3a9acbd0a9f213da6cc595f97081283a87a03
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3900
Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/load/import.go b/cue/load/import.go
index 01bfe30..9fe0ca0 100644
--- a/cue/load/import.go
+++ b/cue/load/import.go
@@ -401,9 +401,6 @@
if !isTest || fp.c.Tests {
fp.imported[path] = append(fp.imported[path], spec.Pos())
}
- if !isTool && strings.HasPrefix(path, "tool/") {
- badFile(errors.Newf(spec.Pos(), "%s may only be imported in *_tool.cue files", quoted))
- }
}
}
switch {
diff --git a/cue/load/loader_test.go b/cue/load/loader_test.go
index 94485ab..a7aa867 100644
--- a/cue/load/loader_test.go
+++ b/cue/load/loader_test.go
@@ -239,18 +239,6 @@
root: $CWD/testdata
dir: $CWD/testdata/toolonly
display:./toolonly`,
- }, {
- cfg: &Config{
- Dir: testdataDir,
- },
- args: args("./badtool"),
- want: `
-err: "tool/cli" may only be imported in *_tool.cue files
-path: example.org/test/badtool:bad
-module: example.org/test
-root: $CWD/testdata
-dir: $CWD/testdata/badtool
-display:./badtool`,
}}
for i, tc := range testCases {
// if i != 5 {
diff --git a/cue/load/testdata/badtool/bad.cue b/cue/load/testdata/badtool/bad.cue
deleted file mode 100644
index 76c5a69..0000000
--- a/cue/load/testdata/badtool/bad.cue
+++ /dev/null
@@ -1,9 +0,0 @@
-package bad
-
-import "tool/cli"
-
-command foo task: {
- foo: cli.Print & {
- text: "foo"
- }
-}