platform.go 759 B

1234567891011121314151617181920212223242526
  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. "context"
  6. "github.com/containerd/log"
  7. )
  8. // Architecture holds the runtime architecture of the process.
  9. //
  10. // Unlike [runtime.GOARCH] (which refers to the compiler platform),
  11. // Architecture refers to the running platform.
  12. //
  13. // For example, Architecture reports "x86_64" as architecture, even
  14. // when running a "linux/386" compiled binary on "linux/amd64" hardware.
  15. var Architecture string
  16. func init() {
  17. var err error
  18. Architecture, err = runtimeArchitecture()
  19. if err != nil {
  20. log.G(context.TODO()).WithError(err).Error("Could not read system architecture info")
  21. }
  22. }