diff options
author | Ayke van Laethem <[email protected]> | 2024-07-09 18:08:51 +0200 |
---|---|---|
committer | Ayke <[email protected]> | 2024-07-13 13:26:26 +0200 |
commit | d7773d3e86e82a64c79a04fa70f740daf333a3be (patch) | |
tree | 99361d45c7872f8da2d2c2e6fea55090942a9570 /testdata | |
parent | b04b690842f837aedc6d8187bb4a4200b0cc6acc (diff) | |
download | tinygo-d7773d3e86e82a64c79a04fa70f740daf333a3be.tar.gz tinygo-d7773d3e86e82a64c79a04fa70f740daf333a3be.zip |
loader: handle `go list` errors inside TinyGo
Instead of exiting with an error, handle these errors internally.
This will enable a few improvements in the future.
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/errors/importcycle/cycle.go | 3 | ||||
-rw-r--r-- | testdata/errors/invaliddep/invaliddep.go | 1 | ||||
-rw-r--r-- | testdata/errors/loader-importcycle.go | 10 | ||||
-rw-r--r-- | testdata/errors/loader-invaliddep.go | 8 | ||||
-rw-r--r-- | testdata/errors/loader-invalidpackage.go | 3 | ||||
-rw-r--r-- | testdata/errors/loader-nopackage.go | 14 |
6 files changed, 39 insertions, 0 deletions
diff --git a/testdata/errors/importcycle/cycle.go b/testdata/errors/importcycle/cycle.go new file mode 100644 index 000000000..40ecf5e23 --- /dev/null +++ b/testdata/errors/importcycle/cycle.go @@ -0,0 +1,3 @@ +package importcycle + +import _ "github.com/tinygo-org/tinygo/testdata/errors/importcycle" diff --git a/testdata/errors/invaliddep/invaliddep.go b/testdata/errors/invaliddep/invaliddep.go new file mode 100644 index 000000000..9b0b1c577 --- /dev/null +++ b/testdata/errors/invaliddep/invaliddep.go @@ -0,0 +1 @@ +ppackage // syntax error diff --git a/testdata/errors/loader-importcycle.go b/testdata/errors/loader-importcycle.go new file mode 100644 index 000000000..4571bdb4d --- /dev/null +++ b/testdata/errors/loader-importcycle.go @@ -0,0 +1,10 @@ +package main + +import _ "github.com/tinygo-org/tinygo/testdata/errors/importcycle" + +func main() { +} + +// ERROR: package command-line-arguments +// ERROR: imports github.com/tinygo-org/tinygo/testdata/errors/importcycle +// ERROR: imports github.com/tinygo-org/tinygo/testdata/errors/importcycle: import cycle not allowed diff --git a/testdata/errors/loader-invaliddep.go b/testdata/errors/loader-invaliddep.go new file mode 100644 index 000000000..db935d38a --- /dev/null +++ b/testdata/errors/loader-invaliddep.go @@ -0,0 +1,8 @@ +package main + +import _ "github.com/tinygo-org/tinygo/testdata/errors/invaliddep" + +func main() { +} + +// ERROR: invaliddep/invaliddep.go:1:1: expected 'package', found ppackage diff --git a/testdata/errors/loader-invalidpackage.go b/testdata/errors/loader-invalidpackage.go new file mode 100644 index 000000000..6d7881047 --- /dev/null +++ b/testdata/errors/loader-invalidpackage.go @@ -0,0 +1,3 @@ +ppackage // syntax error + +// ERROR: loader-invalidpackage.go:1:1: expected 'package', found ppackage diff --git a/testdata/errors/loader-nopackage.go b/testdata/errors/loader-nopackage.go new file mode 100644 index 000000000..c0087fc0b --- /dev/null +++ b/testdata/errors/loader-nopackage.go @@ -0,0 +1,14 @@ +package main + +import ( + _ "github.com/tinygo-org/tinygo/testdata/errors/non-existing-package" + _ "github.com/tinygo-org/tinygo/testdata/errors/non-existing-package-2" +) + +func main() { +} + +// ERROR: loader-nopackage.go:4:2: no required module provides package github.com/tinygo-org/tinygo/testdata/errors/non-existing-package; to add it: +// ERROR: go get github.com/tinygo-org/tinygo/testdata/errors/non-existing-package +// ERROR: loader-nopackage.go:5:2: no required module provides package github.com/tinygo-org/tinygo/testdata/errors/non-existing-package-2; to add it: +// ERROR: go get github.com/tinygo-org/tinygo/testdata/errors/non-existing-package-2 |