To get the system architecture in Go, we can use the runtime and os packages. The runtime package provides information about the Go runtime and the os package provides information about the operating system.
Here is an example code block for getting the architecture of the system:
main.go117 chars11 linesThe runtime.GOARCH constant returns a string that represents the architecture of the system. This constant is defined at compile time and is based on the architecture of the machine that the compiler is running on. It can be "amd64", "arm64", "386", etc.
gistlibby LogSnag