Derive cpuinfo as needed, instead of at init-time
This changes platforms.Parse to hit /proc to look up CPU info only when it's needed, instead of in init(). This makes the package a bit easier for other packages to consume, especially clients that don't call platforms.Parse or need to lookup CPU info. Signed-off-by: Jason Hall <jasonhall@redhat.com>
This commit is contained in:
@@ -28,7 +28,7 @@ func TestDefault(t *testing.T) {
|
||||
expected := specs.Platform{
|
||||
OS: runtime.GOOS,
|
||||
Architecture: runtime.GOARCH,
|
||||
Variant: cpuVariant,
|
||||
Variant: cpuVariant(),
|
||||
}
|
||||
p := DefaultSpec()
|
||||
if !reflect.DeepEqual(p, expected) {
|
||||
|
||||
Reference in New Issue
Block a user