1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-08 03:23:26 +00:00

version: show build tags and type of executable

This patch modifies the output of `rclone version`.
The `os/arch` line is split into `os/type` and `os/arch`.
The `go version` line is now tagged as `go/version` for consistency.

Additionally the `go/linking` line tells whether the rclone
was linked as a static or dynamic executable.
The new `go/tags` line shows a space separated list of build tags.

The info about linking and build tags is also added to the output
of the `core/version` RC endpoint.
This commit is contained in:
Ivan Andreev
2021-03-21 15:13:09 +03:00
parent 268a7ff7b8
commit ef5c212f9b
6 changed files with 71 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/obscure"
"github.com/rclone/rclone/lib/atexit"
"github.com/rclone/rclone/lib/buildinfo"
)
func init() {
@@ -179,6 +180,8 @@ This shows the current version of go and the go runtime
- os - OS in use as according to Go
- arch - cpu architecture in use according to Go
- goVersion - version of Go runtime in use
- linking - type of rclone executable (static or dynamic)
- goTags - space separated build tags or "none"
`,
})
@@ -190,6 +193,7 @@ func rcVersion(ctx context.Context, in Params) (out Params, err error) {
if err != nil {
return nil, err
}
linking, tagString := buildinfo.GetLinkingAndTags()
out = Params{
"version": fs.Version,
"decomposed": version.Slice(),
@@ -198,6 +202,8 @@ func rcVersion(ctx context.Context, in Params) (out Params, err error) {
"os": runtime.GOOS,
"arch": runtime.GOARCH,
"goVersion": runtime.Version(),
"linking": linking,
"goTags": tagString,
}
return out, nil
}
@@ -425,9 +431,7 @@ func rcRunCommand(ctx context.Context, in Params) (out Params, err error) {
allArgs = append(allArgs, command)
}
// Add all from arg
for _, cur := range arg {
allArgs = append(allArgs, cur)
}
allArgs = append(allArgs, arg...)
// Add flags to args for e.g. --max-depth 1 comes in as { max-depth 1 }.
// Convert it to [ max-depth, 1 ] and append to args list