all: Add build constants for runtime.GOOS comparisons (#8442)
all: Add package runtimeos for runtime.GOOS comparisons I grew tired of hand written string comparisons. This adds generated constants for the GOOS values, and predefined Is$OS constants that can be iffed on. In a couple of places I rewrote trivial switch:es to if:s, and added Illumos where we checked for Solaris (because they are effectively the same, and if we're going to target one of them that would be Illumos...).
This commit is contained in:
+2
-1
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/thejerf/suture/v4"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/connections"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
@@ -2399,7 +2400,7 @@ func (m *model) numHashers(folder string) int {
|
||||
return folderCfg.Hashers
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "android" {
|
||||
if build.IsWindows || build.IsDarwin || build.IsAndroid {
|
||||
// Interactive operating systems; don't load the system too heavily by
|
||||
// default.
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user