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:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/d4l3k/messagediff"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
"github.com/syncthing/syncthing/lib/events"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
@@ -445,7 +446,7 @@ func TestVersioningConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIssue1262(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
if !build.IsWindows {
|
||||
t.Skipf("path gets converted to absolute as part of the filesystem initialization on linux")
|
||||
}
|
||||
|
||||
@@ -538,7 +539,7 @@ func TestFolderCheckPath(t *testing.T) {
|
||||
path: "link",
|
||||
err: nil,
|
||||
})
|
||||
} else if runtime.GOOS != "windows" {
|
||||
} else if !build.IsWindows {
|
||||
t.Log("running without symlink check")
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -593,7 +594,7 @@ func TestNewSaveLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWindowsLineEndings(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
if !build.IsWindows {
|
||||
t.Skip("Windows specific")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user