version: simplify iOS detection now that we require Go 1.16

See https://golang.org/doc/go1.16#darwin

No need for build tag tricks anymore.
pull/1747/head
Brad Fitzpatrick 4 years ago
parent cad8df500c
commit 7f8519c88f

@ -8,15 +8,13 @@ import "runtime"
// IsMobile reports whether this is a mobile client build. // IsMobile reports whether this is a mobile client build.
func IsMobile() bool { func IsMobile() bool {
// Good enough heuristic for now, at least until Apple makes return runtime.GOOS == "android" || runtime.GOOS == "ios"
// ARM laptops...
return runtime.GOOS == "android" || isIOS
} }
// OS returns runtime.GOOS, except instead of returning "darwin" it // OS returns runtime.GOOS, except instead of returning "darwin" it
// returns "iOS" or "macOS". // returns "iOS" or "macOS".
func OS() string { func OS() string {
if isIOS { if runtime.GOOS == "ios" {
return "iOS" return "iOS"
} }
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" {

@ -1,9 +0,0 @@
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ios
package version
const isIOS = true

@ -1,9 +0,0 @@
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !ios
package version
const isIOS = false
Loading…
Cancel
Save