Create a file named uuidgen.go
.
package main
import (
"fmt"
"log"
"os/exec"
)
func main() {
out, err := exec.Command("uuidgen").Output()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s", out)
}
Run the following command test uuid generator
go run uuidgen.go
Run the following command to build uuidgen.exe
.
GOOS=windows GOARCH=amd64 go build -o uudigen.exe uuidgen.go