aboutsummaryrefslogtreecommitdiff
path: root/build.go
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2022-07-28 19:36:39 +0200
committerGitHub <noreply@github.com>2022-07-28 19:36:39 +0200
commita3c724f2c37f05983398c28588dd67b73e31ba0d (patch)
treeeffa59b1956b8440a729cbd0ddeb7f5ac375359c /build.go
parentf13d65262a928a3d335c0c17ede27cce8bb792f0 (diff)
downloadsyncthing-a3c724f2c37f05983398c28588dd67b73e31ba0d.tar.gz
syncthing-a3c724f2c37f05983398c28588dd67b73e31ba0d.zip
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...).
Diffstat (limited to 'build.go')
-rw-r--r--build.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/build.go b/build.go
index ff9419325..0b77ac02f 100644
--- a/build.go
+++ b/build.go
@@ -31,6 +31,8 @@ import (
"strings"
"text/template"
"time"
+
+ buildpkg "github.com/syncthing/syncthing/lib/build"
)
var (
@@ -393,7 +395,7 @@ func test(tags []string, pkgs ...string) {
if runtime.GOARCH == "amd64" {
switch runtime.GOOS {
- case "darwin", "linux", "freebsd": // , "windows": # See https://github.com/golang/go/issues/27089
+ case buildpkg.Darwin, buildpkg.Linux, buildpkg.FreeBSD: // , "windows": # See https://github.com/golang/go/issues/27089
args = append(args, "-race")
}
}