mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 06:07:44 +00:00
Split go_target
into go_os
and go_arch
This commit is contained in:
parent
10cbc169c1
commit
ce53ea32c6
@ -1,7 +1,7 @@
|
|||||||
Enhancement: Add support for `--json` option to `version` command
|
Enhancement: Add support for `--json` option to `version` command
|
||||||
|
|
||||||
Restic now supports outputting restic version and used go version and platform
|
Restic now supports outputting restic version and used go version, OS and
|
||||||
target via json when using the version command.
|
architecture via JSON when using the version command.
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/4547
|
https://github.com/restic/restic/issues/4547
|
||||||
https://github.com/restic/restic/pull/4553
|
https://github.com/restic/restic/pull/4553
|
||||||
|
@ -26,18 +26,20 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
|
|||||||
type jsonVersion struct {
|
type jsonVersion struct {
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
GoVersion string `json:"go_version"`
|
GoVersion string `json:"go_version"`
|
||||||
GoTarget string `json:"go_target"`
|
GoOS string `json:"go_os"`
|
||||||
|
GoArch string `json:"go_arch"`
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonS := jsonVersion{
|
jsonS := jsonVersion{
|
||||||
Version: version,
|
Version: version,
|
||||||
GoVersion: runtime.Version(),
|
GoVersion: runtime.Version(),
|
||||||
GoTarget: runtime.GOOS + "/" + runtime.GOARCH,
|
GoOS: runtime.GOOS,
|
||||||
|
GoArch: runtime.GOARCH,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := json.NewEncoder(globalOptions.stdout).Encode(jsonS)
|
err := json.NewEncoder(globalOptions.stdout).Encode(jsonS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warnf("Encode failed: %v\n", err)
|
Warnf("JSON encode failed: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -588,5 +588,7 @@ The version command returns a single JSON object.
|
|||||||
+----------------+--------------------+
|
+----------------+--------------------+
|
||||||
| ``go_version`` | Go compile version |
|
| ``go_version`` | Go compile version |
|
||||||
+----------------+--------------------+
|
+----------------+--------------------+
|
||||||
| ``go_target`` | Go target platform |
|
| ``go_os`` | Go OS |
|
||||||
|
+----------------+--------------------+
|
||||||
|
| ``go_arch`` | Go architecture |
|
||||||
+----------------+--------------------+
|
+----------------+--------------------+
|
||||||
|
Loading…
Reference in New Issue
Block a user