func main() os.O_WRONLY, 0644) if err != nil log.Fatal(err)
To build a (no console window), use:
go build -ldflags="-s -w" -o tool.exe You can also use UPX (Ultimate Packer for Executables) to shrink further, but stripped builds are usually enough. Go 1.20+ supports Windows 7 and later. Set environment variables for older compatibility: golang portable windows