sketch: support Linux with -unsafe
hostReqsCheck wants too much in unsafe mode, and Colima doesn't make
sense for Linux anwyay, so let's fix that.
Co-Authored-By: sketch
diff --git a/cmd/sketch/main.go b/cmd/sketch/main.go
index 6ef8049..19bb803 100644
--- a/cmd/sketch/main.go
+++ b/cmd/sketch/main.go
@@ -111,7 +111,7 @@
}
if !inDocker {
- msgs, err := hostReqsCheck()
+ msgs, err := hostReqsCheck(*unsafe)
if *verbose {
fmt.Println("Host requirement checks:")
for _, m := range msgs {
diff --git a/cmd/sketch/reqchecks.go b/cmd/sketch/reqchecks.go
index 2a1210f..9a8511e 100644
--- a/cmd/sketch/reqchecks.go
+++ b/cmd/sketch/reqchecks.go
@@ -3,6 +3,7 @@
import (
"fmt"
"os/exec"
+ "runtime"
"strings"
"sync"
@@ -53,11 +54,25 @@
type reqCheckFunc func() (string, error)
-func hostReqsCheck() ([]string, error) {
+func hostReqsCheck(isUnsafe bool) ([]string, error) {
var mu sync.Mutex
ret := []string{}
eg := errgroup.Group{}
- cfs := []reqCheckFunc{checkDocker, checkColima, checkNPM}
+ cfs := []reqCheckFunc{}
+
+ // Only check for Docker if we're not in unsafe mode
+ if !isUnsafe {
+ cfs = append(cfs, checkDocker)
+ }
+
+ // Only check for Colima on macOS and in safe mode
+ if runtime.GOOS == "darwin" && !isUnsafe {
+ cfs = append(cfs, checkColima)
+ }
+
+ // Always check for NPM
+ cfs = append(cfs, checkNPM)
+
eg.SetLimit(len(cfs))
for _, f := range cfs {
eg.Go(func() error {