internal/coordinator/remote: run env setup for windows

This change updates the setup scripts for SSH sessions running on Windows.

Change-Id: If561fbc329dce242304d779f98bd80ccb0bead88
Reviewed-on: https://go-review.googlesource.com/c/build/+/543097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/internal/coordinator/remote/ssh.go b/internal/coordinator/remote/ssh.go
index f79eb09..733c11d 100644
--- a/internal/coordinator/remote/ssh.go
+++ b/internal/coordinator/remote/ssh.go
@@ -435,7 +435,7 @@
 		}
 	}()
 	go func() {
-		ss.setupRemoteSSHEnvSwarm(workDir, f)
+		ss.setupRemoteSSHEnvSwarm(rs.BuilderType, workDir, f)
 		io.Copy(f, s) // stdin
 	}()
 	io.Copy(s, f) // stdout
@@ -445,7 +445,13 @@
 
 // setupRemoteSSHEnvSwarm prints environmental details to the writer.
 // This makes the new SSH session easier to use for Go testing.
-func (ss *SSHServer) setupRemoteSSHEnvSwarm(workDir string, f io.Writer) {
+func (ss *SSHServer) setupRemoteSSHEnvSwarm(builderType, workDir string, f io.Writer) {
+	if strings.Contains(builderType, "windows") {
+		fmt.Fprintf(f, `set GOPATH=%s\gopath`+"\n", workDir)
+		fmt.Fprintf(f, `set PATH=%%PATH%%;%s\go\bin`+"\n", workDir)
+		fmt.Fprintf(f, `cd %s\go\src`+"\n", workDir)
+		return
+	}
 	fmt.Fprintf(f, "GOPATH=%s/gopath\n", workDir)
 	fmt.Fprintf(f, "PATH=$PATH:%s/go/bin\n", workDir)
 	fmt.Fprintf(f, "export GOPATH PATH\n")