Go module to check whether your program is running on Windows Subsystem for Linux.
This module works by checking the contents of /proc/sys/kernel/osrelease
.
$ go get go.zakaria.org/wslcheck
package main
import (
"fmt"
"github.com/e-zk/wslcheck"
)
func main() {
fmt.Printf("Am I running on WSL?\n")
wsl, _ := wslcheck.Check()
if wsl == true {
fmt.Printf("Yes!\n")
} else {
fmt.Printf("No!\n")
}
}