exit if run amd64 binary on M1 cpu
parent
22099c8a14
commit
d1431f67a6
|
@ -93,6 +93,10 @@ func Execute() {
|
|||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "darwin" && detect.IsAmd64M1Emulation() {
|
||||
exit.Message(reason.WrongBinaryM1, "You are trying to run amd64 binary on M1 system. Please use darwin/arm64 binary instead.")
|
||||
}
|
||||
|
||||
_, callingCmd := filepath.Split(os.Args[0])
|
||||
|
||||
if callingCmd == "kubectl" {
|
||||
|
|
3
go.mod
3
go.mod
|
@ -38,7 +38,7 @@ require (
|
|||
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect
|
||||
github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214 // indirect
|
||||
github.com/hooklift/iso9660 v0.0.0-20170318115843-1cf07e5970d8
|
||||
github.com/intel-go/cpuid v0.0.0-20181003105527-1a4a6f06a1c6 // indirect
|
||||
github.com/intel-go/cpuid v0.0.0-20181003105527-1a4a6f06a1c6
|
||||
github.com/johanneswuerbach/nfsexports v0.0.0-20200318065542-c48c3734757f
|
||||
github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c
|
||||
github.com/juju/errors v0.0.0-20190806202954-0232dcc7464d // indirect
|
||||
|
@ -50,6 +50,7 @@ require (
|
|||
github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d // indirect
|
||||
github.com/juju/version v0.0.0-20180108022336-b64dbd566305 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/klauspost/cpuid v1.2.0
|
||||
github.com/libvirt/libvirt-go v3.9.0+incompatible
|
||||
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1
|
||||
github.com/mattbaird/jsonpatch v0.0.0-20200820163806-098863c1fc24
|
||||
|
|
2
go.sum
2
go.sum
|
@ -642,6 +642,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
|||
github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc=
|
||||
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
|
@ -808,6 +809,7 @@ github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3
|
|||
github.com/otiai10/copy v1.5.0 h1:SoXDGnlTUZoqB/wSuj/Y5L6T5i6iN4YRAcMCd+JnLNU=
|
||||
github.com/otiai10/copy v1.5.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
|
||||
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
|
||||
github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
|
||||
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
|
||||
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
|
||||
github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E=
|
||||
|
|
|
@ -17,8 +17,11 @@ limitations under the License.
|
|||
package detect
|
||||
|
||||
import (
|
||||
. "github.com/klauspost/cpuid"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IsMicrosoftWSL will return true if process is running in WSL in windows
|
||||
|
@ -43,3 +46,8 @@ func IsCloudShell() bool {
|
|||
_, e := os.LookupEnv("CLOUDSHELL_ENVIRONMENT")
|
||||
return e
|
||||
}
|
||||
|
||||
// IsAmd64M1Emulation determines whether amd64 minikube binary is running on M1 mac in emulation mode
|
||||
func IsAmd64M1Emulation() bool {
|
||||
return runtime.GOARCH == "amd64" && strings.HasPrefix(CPU.BrandName, "VirtualApple")
|
||||
}
|
|
@ -81,6 +81,7 @@ var (
|
|||
Interrupted = Kind{ID: "MK_INTERRUPTED", ExitCode: ExProgramConflict}
|
||||
|
||||
WrongBinaryWSL = Kind{ID: "MK_WRONG_BINARY_WSL", ExitCode: ExProgramUnsupported}
|
||||
WrongBinaryM1 = Kind{ID: "MK_WRONG_BINARY_M1", ExitCode: ExProgramUnsupported}
|
||||
|
||||
NewAPIClient = Kind{ID: "MK_NEW_APICLIENT", ExitCode: ExProgramError}
|
||||
InternalAddonEnable = Kind{ID: "MK_ADDON_ENABLE", ExitCode: ExProgramError}
|
||||
|
|
Loading…
Reference in New Issue