OS returns runtime.GOOS, except instead of returning "darwin" it returns "iOS" or "macOS".
()
| 39 | // OS returns runtime.GOOS, except instead of returning "darwin" it returns |
| 40 | // "iOS" or "macOS". |
| 41 | func OS() string { |
| 42 | // If you're wondering why we have this function that just returns |
| 43 | // runtime.GOOS written differently: in the old days, Go reported |
| 44 | // GOOS=darwin for both iOS and macOS, so we needed this function to |
| 45 | // differentiate them. Then a later Go release added GOOS=ios as a separate |
| 46 | // platform, but by then the "iOS" and "macOS" values we'd picked, with that |
| 47 | // exact capitalization, were already baked into databases. |
| 48 | if IsAppleTV() { |
| 49 | return "tvOS" |
| 50 | } |
| 51 | if runtime.GOOS == "ios" { |
| 52 | return "iOS" |
| 53 | } |
| 54 | if runtime.GOOS == "darwin" { |
| 55 | return "macOS" |
| 56 | } |
| 57 | return runtime.GOOS |
| 58 | } |
| 59 | |
| 60 | // IsMacGUIVariant reports whether runtime.GOOS=="darwin" and this one of the |
| 61 | // two GUI variants (that is, not tailscaled-on-macOS). |
no test coverage detected