I'm using Go 1.10 in windows:
For some reason it appears as if -ldflags doesn't allow combining flags when used with exec.CommandContext.
cmd = exec.CommandContext(ctx, "go", "build", "-o", outputPath, "-ldflags=-s", "-ldflags=-w", "-ldflags \"-H windowsgui\"", goFilePath)
cmd.Env = append(os.Environ(), fmt.Sprintf("%s=%s", "GOOS", "windows"))
cmd.CombinedOutput()
The later ldflag flag seems to overwrite the prior.