mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 08:03:43 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			854 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			854 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package pb
 | |
| 
 | |
| import (
 | |
| 	specs "github.com/opencontainers/image-spec/specs-go/v1"
 | |
| )
 | |
| 
 | |
| func (p *Platform) Spec() specs.Platform {
 | |
| 	return specs.Platform{
 | |
| 		OS:           p.OS,
 | |
| 		Architecture: p.Architecture,
 | |
| 		Variant:      p.Variant,
 | |
| 		OSVersion:    p.OSVersion,
 | |
| 		OSFeatures:   p.OSFeatures,
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func PlatformFromSpec(p specs.Platform) Platform {
 | |
| 	return Platform{
 | |
| 		OS:           p.OS,
 | |
| 		Architecture: p.Architecture,
 | |
| 		Variant:      p.Variant,
 | |
| 		OSVersion:    p.OSVersion,
 | |
| 		OSFeatures:   p.OSFeatures,
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func ToSpecPlatforms(p []Platform) []specs.Platform {
 | |
| 	out := make([]specs.Platform, 0, len(p))
 | |
| 	for _, pp := range p {
 | |
| 		out = append(out, pp.Spec())
 | |
| 	}
 | |
| 	return out
 | |
| }
 | |
| 
 | |
| func PlatformsFromSpec(p []specs.Platform) []Platform {
 | |
| 	out := make([]Platform, 0, len(p))
 | |
| 	for _, pp := range p {
 | |
| 		out = append(out, PlatformFromSpec(pp))
 | |
| 	}
 | |
| 	return out
 | |
| }
 | 
