-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request moby#48862 from thaJeztah/deprecate_pkg_platform
deprecate pkg/platform and move internal
- Loading branch information
Showing
6 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package platform | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
|
||
"github.com/containerd/log" | ||
) | ||
|
||
var ( | ||
arch string | ||
onceArch sync.Once | ||
) | ||
|
||
// Architecture returns the runtime architecture of the process. | ||
// | ||
// Unlike [runtime.GOARCH] (which refers to the compiler platform), | ||
// Architecture refers to the running platform. | ||
// | ||
// For example, Architecture reports "x86_64" as architecture, even | ||
// when running a "linux/386" compiled binary on "linux/amd64" hardware. | ||
func Architecture() string { | ||
onceArch.Do(func() { | ||
var err error | ||
arch, err = runtimeArchitecture() | ||
if err != nil { | ||
log.G(context.TODO()).WithError(err).Error("Could not read system architecture info") | ||
} | ||
}) | ||
return arch | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
pkg/platform/platform_windows.go → internal/platform/platform_windows.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package platform // import "github.com/docker/docker/pkg/platform" | ||
package platform | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters