The variant is required for platform match while pulling images for ARM platforms. Currently, the cpuVariant only would be assigned on linux/arm|arm64 platforms. Other platforms this variable would be empty. So we can use this cpuVariant to initialize the Variant field. Change-Id: Ic065be9b502f1e662445daa61a0973bf56385b37 Signed-off-by: Wei Chen <Wei.Chen@arm.com> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
		
			
				
	
	
		
			23 lines
		
	
	
		
			498 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			498 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package platforms
 | 
						|
 | 
						|
import (
 | 
						|
	"runtime"
 | 
						|
 | 
						|
	specs "github.com/opencontainers/image-spec/specs-go/v1"
 | 
						|
)
 | 
						|
 | 
						|
// Default returns the default specifier for the platform.
 | 
						|
func Default() string {
 | 
						|
	return Format(DefaultSpec())
 | 
						|
}
 | 
						|
 | 
						|
// DefaultSpec returns the current platform's default platform specification.
 | 
						|
func DefaultSpec() specs.Platform {
 | 
						|
	return specs.Platform{
 | 
						|
		OS:           runtime.GOOS,
 | 
						|
		Architecture: runtime.GOARCH,
 | 
						|
		// The Variant field will be empty if arch != ARM.
 | 
						|
		Variant: cpuVariant,
 | 
						|
	}
 | 
						|
}
 |