platform.go 733 B

123456789101112131415161718192021222324
  1. // Package platform provides helper function to get the runtime architecture
  2. // for different platforms.
  3. package platform // import "github.com/docker/docker/pkg/platform"
  4. import (
  5. "github.com/sirupsen/logrus"
  6. )
  7. // Architecture holds the runtime architecture of the process.
  8. //
  9. // Unlike [runtime.GOARCH] (which refers to the compiler platform),
  10. // Architecture refers to the running platform.
  11. //
  12. // For example, Architecture reports "x86_64" as architecture, even
  13. // when running a "linux/386" compiled binary on "linux/amd64" hardware.
  14. var Architecture string
  15. func init() {
  16. var err error
  17. Architecture, err = runtimeArchitecture()
  18. if err != nil {
  19. logrus.WithError(err).Error("Could not read system architecture info")
  20. }
  21. }