Skip to content

Commit

Permalink
detect arm version from runtime internal register
Browse files Browse the repository at this point in the history
  • Loading branch information
creativeprojects committed Nov 6, 2020
1 parent 604da32 commit 8d95c1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

import (
_ "unsafe"
)

//go:linkname goarm runtime.goarm
var goarm uint8
3 changes: 3 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func displayVersion(_ *config.Config, flags commandLineFlags, _ []string) error
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "home", "https://github.com/creativeprojects/resticprofile")
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "os", runtime.GOOS)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "arch", runtime.GOARCH)
if goarm > 0 {
_, _ = fmt.Fprintf(w, "\t%s:\tv%d\n", "arm", goarm)
}
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "version", version)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "commit", commit)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "compiled", date)
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ Can you please open an issue on github including these details:
w := tabwriter.NewWriter(os.Stderr, 0, 0, 3, ' ', 0)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "os", runtime.GOOS)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "arch", runtime.GOARCH)
if goarm > 0 {
_, _ = fmt.Fprintf(w, "\t%s:\tv%d\n", "arm", goarm)
}
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "version", version)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "commit", commit)
_, _ = fmt.Fprintf(w, "\t%s:\t%s\n", "compiled", date)
Expand Down

0 comments on commit 8d95c1e

Please sign in to comment.