github.com/containerd/Containerd@v1.4.13/platforms/defaults.go (about) 1 /* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package platforms 18 19 import ( 20 "runtime" 21 22 specs "github.com/opencontainers/image-spec/specs-go/v1" 23 ) 24 25 // DefaultString returns the default string specifier for the platform. 26 func DefaultString() string { 27 return Format(DefaultSpec()) 28 } 29 30 // DefaultSpec returns the current platform's default platform specification. 31 func DefaultSpec() specs.Platform { 32 return specs.Platform{ 33 OS: runtime.GOOS, 34 Architecture: runtime.GOARCH, 35 // The Variant field will be empty if arch != ARM. 36 Variant: cpuVariant, 37 } 38 }