mirror of https://github.com/docker/cli.git
vendor: github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
full diff: f79598599c...3f4430f2d3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
81401f37f2
commit
11fbc99939
|
@ -39,7 +39,7 @@ require (
|
|||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
|
||||
github.com/xeipuuv/gojsonschema v1.2.0
|
||||
go.opentelemetry.io/otel v1.28.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0
|
||||
|
|
|
@ -266,8 +266,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
|
|||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a h1:tlJ7tGUHvcvL1v3yR6NcCc9nOqh2L+CG6HWrYQtwzQ0=
|
||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a/go.mod h1:Y94A6rPp2OwNfP/7vmf8O2xx2IykP8pPXQ1DLouGnEw=
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d h1:wvQZpqy8p0D/FUia6ipKDhXrzPzBVJE4PZyPc5+5Ay0=
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ=
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346 h1:TvtdmeYsYEij78hS4oxnwikoiLdIrgav3BA+CbhaDAI=
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ=
|
||||
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b h1:FsyNrX12e5BkplJq7wKOLk0+C6LZ+KGXvuEcKUYm5ss=
|
||||
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
go-rosetta
|
||||
==========
|
||||
|
||||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/tonistiigi/go-rosetta)](https://pkg.go.dev/github.com/tonistiigi/go-rosetta)
|
||||
|
||||
`go-rosetta` provides utilities to detect if an application is running as a
|
||||
[Rosetta](https://developer.apple.com/documentation/apple_silicon/about_the_rosetta_translation_environment) translated binary, and
|
||||
to determine the native architecture.
|
|
@ -1,17 +1,28 @@
|
|||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package rosetta
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Available returns true if Rosetta is installed/available
|
||||
func Available() bool {
|
||||
_, err := os.Stat("/Library/Apple/usr/share/rosetta")
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// Enabled returns true if running in a Rosetta Translated Binary, false otherwise.
|
||||
func Enabled() bool {
|
||||
v, err := syscall.SysctlUint32("sysctl.proc_translated")
|
||||
return err == nil && v == 1
|
||||
}
|
||||
|
||||
// NativeArch returns the native architecture, even if binary architecture
|
||||
// is emulated by Rosetta.
|
||||
func NativeArch() string {
|
||||
if Enabled() && runtime.GOARCH == "amd64" {
|
||||
return "arm64"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//go:build !darwin
|
||||
// +build !darwin
|
||||
|
||||
package rosetta
|
||||
|
@ -6,10 +7,18 @@ import (
|
|||
"runtime"
|
||||
)
|
||||
|
||||
// Available returns true if Rosetta is installed/available
|
||||
func Available() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Enabled returns true if running in a Rosetta Translated Binary, false otherwise.
|
||||
func Enabled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// NativeArch returns the native architecture, even if binary architecture
|
||||
// is emulated by Rosetta.
|
||||
func NativeArch() string {
|
||||
return runtime.GOARCH
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ github.com/theupdateframework/notary/tuf/data
|
|||
github.com/theupdateframework/notary/tuf/signed
|
||||
github.com/theupdateframework/notary/tuf/utils
|
||||
github.com/theupdateframework/notary/tuf/validation
|
||||
# github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d
|
||||
# github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
|
||||
## explicit; go 1.13
|
||||
github.com/tonistiigi/go-rosetta
|
||||
# github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
|
||||
|
|
Loading…
Reference in New Issue