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:
@@ -10,9 +10,10 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
)
|
||||
|
||||
func TestMtimeFS(t *testing.T) {
|
||||
@@ -181,11 +182,10 @@ func TestMtimeFSOpen(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMtimeFSInsensitive(t *testing.T) {
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "windows":
|
||||
if build.IsDarwin || build.IsWindows {
|
||||
// blatantly assume file systems here are case insensitive. Might be
|
||||
// a spurious failure on oddly configured systems.
|
||||
default:
|
||||
} else {
|
||||
t.Skip("need case insensitive FS")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user