Repository: go
Issue: cmd/go: CGO_CFLAGS variable with spaces is parsed incorrectly on windows
Labels: help wanted,NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.16.2 windows/amd64
</pre>

### Does this issue reproduce with the latest release? 
yes

### What operating system and processor architecture are you using?

windows10, amd64, intel

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\justin\AppData\Local\go-build
set GOENV=C:\Users\justin\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\justin\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\justin\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.2
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\justin\AppData\Local\Temp\go-build995163971=/tmp/go-build -gno-record-gcc-switches
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

While attempting to build a cgo project on windows, I am finding that the value `CGO_CFLAGS` is parsed incorrectly if an include path contains spaces. 

```
.
├── go.mod
├── main.c
└── main.go
```

```
// main.go
package main

import "C"

func main() {}
```

```
// main.c
// <empty>
```

```
> set CGO_CFLAGS='-IC:/Program Files/Foo'
> go env CGO_CFLAGS
'-IC:/Program Files/Foo'

> go build -x
WORK=C:\Users\justin\AppData\Local\Temp\go-build1942282733
mkdir -p $WORK\b003\
cd C:\Program Files\Go\src\runtime\cgo
TERM='dumb' CGO_LDFLAGS='"-g" "-O2"' "C:\\Program Files\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir "$WORK\\b003\\" -importpath runtime/cgo -import_runtime_cgo=false -import_syscall=false -- -I "$WORK\\b003\\" '-IC:/Program Files/Foo' -Wall -Werror "C:\\Program Files\\Go\\src\\runtime\\cgo\\cgo.go"
# runtime/cgo
gcc: error: '-IC:/Program: Invalid argument
gcc: error: Files/Foo': No such file or directory
```

I've also tried various combinations of quoting and escaping with no change in result:
```
set CGO_CFLAGS=-I'C:/Program Files/Foo'
set CGO_CFLAGS='-IC:/Program\ Files/Foo'
set CGO_CFLAGS='-IC:/Program\\ Files/Foo'
```

### What did you expect to see?

I would expect the full single string value of "C:/Program Files/Foo" to be passed to the "-I" include flag when compiling.

### What did you see instead?

The path is split on spaces, acting like multiple arguments to `gcc`
```
# runtime/cgo
gcc: error: '-IC:/Program: Invalid argument
gcc: error: Files/Foo': No such file or directory
```