|
@@ -8,18 +8,23 @@ import (
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
)
|
|
|
|
|
|
-var (
|
|
|
|
- // Architecture holds the runtime architecture of the process.
|
|
|
|
- Architecture string
|
|
|
|
- // OSType holds the runtime operating system type (Linux, …) of the process.
|
|
|
|
- OSType string
|
|
|
|
-)
|
|
|
|
|
|
+// Architecture holds the runtime architecture of the process.
|
|
|
|
+//
|
|
|
|
+// Unlike [runtime.GOARCH] (which refers to the compiler platform),
|
|
|
|
+// Architecture refers to the running platform.
|
|
|
|
+//
|
|
|
|
+// For example, Architecture reports "x86_64" as architecture, even
|
|
|
|
+// when running a "linux/386" compiled binary on "linux/amd64" hardware.
|
|
|
|
+var Architecture string
|
|
|
|
+
|
|
|
|
+// OSType holds the runtime operating system type of the process. It is
|
|
|
|
+// an alias for [runtime.GOOS].
|
|
|
|
+const OSType = runtime.GOOS
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
var err error
|
|
var err error
|
|
Architecture, err = runtimeArchitecture()
|
|
Architecture, err = runtimeArchitecture()
|
|
if err != nil {
|
|
if err != nil {
|
|
- logrus.Errorf("Could not read system architecture info: %v", err)
|
|
|
|
|
|
+ logrus.WithError(err).Error("Could not read system architecture info")
|
|
}
|
|
}
|
|
- OSType = runtime.GOOS
|
|
|
|
}
|
|
}
|