File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ import (
15
15
"strings"
16
16
)
17
17
18
+ // TINYGOROOT is the path to the final location for checking tinygo files. If
19
+ // unset (by a -X ldflag), then sourceDir() will fallback to the original build
20
+ // directory.
21
+ var TINYGOROOT string
22
+
18
23
// Target specification for a given target. Used for bare metal targets.
19
24
//
20
25
// The target specification is mostly inspired by Rust:
@@ -270,6 +275,14 @@ func sourceDir() string {
270
275
return root
271
276
}
272
277
278
+ if TINYGOROOT != "" {
279
+ if ! isSourceDir (TINYGOROOT ) {
280
+ fmt .Fprintln (os .Stderr , "error: TINYGOROOT was not set to the correct root" )
281
+ os .Exit (1 )
282
+ }
283
+ return TINYGOROOT
284
+ }
285
+
273
286
// Find root from executable path.
274
287
path , err := os .Executable ()
275
288
if err != nil {
You can’t perform that action at this time.
0 commit comments