aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-09-14 14:09:46 +0200
committerRon Evans <[email protected]>2022-09-15 12:43:51 +0200
commit5f96d2b7843ceebeedd91acae0985f3bcb8a7516 (patch)
tree15c8a0332f5679e5d9d1d459b065be88ab2e102b /main.go
parentbd1d93b7058e19ebd82b57171eb7bf4f8bd42411 (diff)
downloadtinygo-5f96d2b7843ceebeedd91acae0985f3bcb8a7516.tar.gz
tinygo-5f96d2b7843ceebeedd91acae0985f3bcb8a7516.zip
all: add flag for setting the goroutine stack size
This is helpful in some cases where the default stack size isn't big enough.
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.go b/main.go
index 51208b063..3fc6e765b 100644
--- a/main.go
+++ b/main.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/google/shlex"
+ "github.com/inhies/go-bytesize"
"github.com/mattn/go-colorable"
"github.com/tinygo-org/tinygo/builder"
"github.com/tinygo-org/tinygo/compileopts"
@@ -1318,6 +1319,12 @@ func main() {
var tags buildutil.TagsFlag
flag.Var(&tags, "tags", "a space-separated list of extra build tags")
target := flag.String("target", "", "chip/board name or JSON target specification file")
+ var stackSize uint64
+ flag.Func("stack-size", "goroutine stack size (if unknown at compile time)", func(s string) error {
+ size, err := bytesize.Parse(s)
+ stackSize = uint64(size)
+ return err
+ })
printSize := flag.String("size", "", "print sizes (none, short, full)")
printStacks := flag.Bool("print-stacks", false, "print stack sizes of goroutines")
printAllocsString := flag.String("print-allocs", "", "regular expression of functions for which heap allocations should be printed")
@@ -1398,6 +1405,7 @@ func main() {
GOARCH: goenv.Get("GOARCH"),
GOARM: goenv.Get("GOARM"),
Target: *target,
+ StackSize: stackSize,
Opt: *opt,
GC: *gc,
PanicStrategy: *panicStrategy,