github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/pkg/platform/platform.go (about) 1 // Package platform provides helper function to get the runtime architecture 2 // for different platforms. 3 package platform // import "github.com/Prakhar-Agarwal-byte/moby/pkg/platform" 4 5 import ( 6 "context" 7 8 "github.com/containerd/log" 9 ) 10 11 // Architecture holds the runtime architecture of the process. 12 // 13 // Unlike [runtime.GOARCH] (which refers to the compiler platform), 14 // Architecture refers to the running platform. 15 // 16 // For example, Architecture reports "x86_64" as architecture, even 17 // when running a "linux/386" compiled binary on "linux/amd64" hardware. 18 var Architecture string 19 20 func init() { 21 var err error 22 Architecture, err = runtimeArchitecture() 23 if err != nil { 24 log.G(context.TODO()).WithError(err).Error("Could not read system architecture info") 25 } 26 }