Better OS checks
This commit is contained in:
parent
0d3bb647ab
commit
58039acc3c
9 changed files with 48 additions and 29 deletions
17
osspecifics/oschecks.go
Normal file
17
osspecifics/oschecks.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package osspecifics
|
||||
|
||||
import "runtime"
|
||||
|
||||
// For some reason, `runtime` package does not provide this while
|
||||
// "goconst" linter complains about us not using constants in
|
||||
// expressions like `runtime.GOOS == "windows"`. And it is
|
||||
// not wrong, accidentally mispelling these OS IDs is a
|
||||
// matter of time.
|
||||
|
||||
func IsWindows() bool {
|
||||
return runtime.GOOS == "windows"
|
||||
}
|
||||
|
||||
func IsMacOS() bool {
|
||||
return runtime.GOOS == "darwin"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue