aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-08-11 16:02:04 +0200
committerRon Evans <[email protected]>2023-08-13 15:27:21 +0200
commit9037bf8bf0fd50bfffd110cbc79ea4a60ef4e781 (patch)
tree1ef4bed6cbb570dcb885e97510563cc3062c9ca2 /main.go
parentbfe9ee378fd7dd1ec9b42b8ca0bfc1b3b7d3e79a (diff)
downloadtinygo-9037bf8bf0fd50bfffd110cbc79ea4a60ef4e781.tar.gz
tinygo-9037bf8bf0fd50bfffd110cbc79ea4a60ef4e781.zip
main: add target JSON file in `tinygo info` output
It looks like this on my system, for example: { "target": { "llvm-target": "aarch64-unknown-linux", "cpu": "generic", "features": "+neon", "goos": "linux", "goarch": "arm64", "build-tags": [ "linux", "arm64" ], "gc": "precise", "scheduler": "tasks", "linker": "ld.lld", "rtlib": "compiler-rt", "libc": "musl", "default-stack-size": 65536, "ldflags": [ "--gc-sections" ], "extra-files": [ "src/runtime/asm_arm64.S", "src/internal/task/task_stack_arm64.S" ], "gdb": [ "gdb" ], "flash-1200-bps-reset": "false" }, "goroot": "/home/ayke/.cache/tinygo/goroot-23c311bcaa05f188affa3c42310aba343acc82562d5e5f04dea9d5b79ac35f7e", "goos": "linux", "goarch": "arm64", "goarm": "6", ... } This can be very useful while working on the automatically generated target object for example (in my case, GOOS=wasip1).
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/main.go b/main.go
index 7af036f17..a11c930ba 100644
--- a/main.go
+++ b/main.go
@@ -1796,15 +1796,17 @@ func main() {
}
if flagJSON {
json, _ := json.MarshalIndent(struct {
- GOROOT string `json:"goroot"`
- GOOS string `json:"goos"`
- GOARCH string `json:"goarch"`
- GOARM string `json:"goarm"`
- BuildTags []string `json:"build_tags"`
- GC string `json:"garbage_collector"`
- Scheduler string `json:"scheduler"`
- LLVMTriple string `json:"llvm_triple"`
+ Target *compileopts.TargetSpec `json:"target"`
+ GOROOT string `json:"goroot"`
+ GOOS string `json:"goos"`
+ GOARCH string `json:"goarch"`
+ GOARM string `json:"goarm"`
+ BuildTags []string `json:"build_tags"`
+ GC string `json:"garbage_collector"`
+ Scheduler string `json:"scheduler"`
+ LLVMTriple string `json:"llvm_triple"`
}{
+ Target: config.Target,
GOROOT: cachedGOROOT,
GOOS: config.GOOS(),
GOARCH: config.GOARCH(),