diff --git a/docker-compose.yml b/docker-compose.yml index 68f12b1..eca4f22 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: deploy: resources: limits: - memory: 1200M + memory: 600M working_dir: /go/src/go-json command: | sh -c "go test -c . && ls go-json.test" diff --git a/internal/encoder/vm/vm.go b/internal/encoder/vm/vm.go index 87651de..7d2ba7b 100644 --- a/internal/encoder/vm/vm.go +++ b/internal/encoder/vm/vm.go @@ -10,6 +10,12 @@ import ( "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/runtime" + + // HACK: compile order + // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent + _ "github.com/goccy/go-json/internal/encoder/vm_escaped" ) const uintptrSize = 4 << (^uintptr(0) >> 63) diff --git a/internal/encoder/vm_escaped/vm.go b/internal/encoder/vm_escaped/vm.go index 7843e6a..53eba06 100644 --- a/internal/encoder/vm_escaped/vm.go +++ b/internal/encoder/vm_escaped/vm.go @@ -10,6 +10,12 @@ import ( "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/runtime" + + // HACK: compile order + // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent + _ "github.com/goccy/go-json/internal/encoder/vm_indent" ) const uintptrSize = 4 << (^uintptr(0) >> 63) diff --git a/internal/encoder/vm_indent/vm.go b/internal/encoder/vm_indent/vm.go index fcae72c..34f49a9 100644 --- a/internal/encoder/vm_indent/vm.go +++ b/internal/encoder/vm_indent/vm.go @@ -11,6 +11,12 @@ import ( "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/runtime" + + // HACK: compile order + // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // so forcibly make dependencies and avoid compiling in concurrent. + // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent + _ "github.com/goccy/go-json/internal/encoder/vm_escaped_indent" ) const uintptrSize = 4 << (^uintptr(0) >> 63)