From f0143db99c2b4322f0f7a8ceaf2105673ac68a0d Mon Sep 17 00:00:00 2001 From: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:15:46 +0100 Subject: [PATCH] more elegant? --- drivers/shared/capabilities/defaults.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/shared/capabilities/defaults.go b/drivers/shared/capabilities/defaults.go index 4c7c2c59898..b86d7aacf98 100644 --- a/drivers/shared/capabilities/defaults.go +++ b/drivers/shared/capabilities/defaults.go @@ -41,11 +41,14 @@ func NomadDefaults() *Set { func Supported() *Set { s := New(nil) - list, _ := capability.ListSupported() - - // capability.ListSupported() will always return an empty list on non-linux - // systems - if runtime.GOOS != "linux" { + var list []capability.Cap + + switch runtime.GOOS { + case "linux": + list, _ = capability.ListSupported() + default: + // capability.ListSupported() will always return an empty list on + // non-linux systems list = capability.ListKnown() }