diff options
author | Ayke van Laethem <[email protected]> | 2023-08-11 16:02:04 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-08-13 15:27:21 +0200 |
commit | 9037bf8bf0fd50bfffd110cbc79ea4a60ef4e781 (patch) | |
tree | 1ef4bed6cbb570dcb885e97510563cc3062c9ca2 /main.go | |
parent | bfe9ee378fd7dd1ec9b42b8ca0bfc1b3b7d3e79a (diff) | |
download | tinygo-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.go | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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(), |