Skip to content

Commit

Permalink
internal/testenv: introduce IsWindowsXP
Browse files Browse the repository at this point in the history
For golang#23072

Change-Id: I089feafef2900413d46f2358b6e41ab78187eced
Reviewed-on: https://go-review.googlesource.com/83076
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
alexbrainman authored and bradfitz committed Dec 10, 2017
1 parent b3a1088 commit d038da7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/internal/testenv/testenv_notwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ func hasSymlink() (ok bool, reason string) {

return true, ""
}

func IsWindowsXP() bool {
return false
}
9 changes: 9 additions & 0 deletions src/internal/testenv/testenv_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ func hasSymlink() (ok bool, reason string) {

return false, ""
}

func IsWindowsXP() bool {
v, err := syscall.GetVersion()
if err != nil {
panic("GetVersion failed: " + err.Error())
}
major := byte(v)
return major < 6
}

0 comments on commit d038da7

Please sign in to comment.