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.
This commit is contained in:
Brad Fitzpatrick 2021-04-19 21:59:55 -07:00
parent cad8df500c
commit 7f8519c88f
3 changed files with 2 additions and 22 deletions

View File

@ -8,15 +8,13 @@
// 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" {

View File

@ -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

View File

@ -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