Skip to content

Commit

Permalink
Test shortening path for stdlib build
Browse files Browse the repository at this point in the history
  • Loading branch information
Xjs committed Aug 7, 2018
1 parent 57ae83c commit 94ca818
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions go/tools/builders/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"strings"
"syscall"
)

func run(args []string) error {
Expand Down Expand Up @@ -51,6 +53,19 @@ func run(args []string) error {
return err
}

if runtime.GOOS == "windows" {
var buf [258]uint16
up, err := syscall.UTF16PtrFromString(output)
if err != nil {
return err
}
_, err = syscall.GetShortPathName(up, &buf[0], 258)
if err != nil {
return err
}
output = syscall.UTF16ToString(buf[:])
}

// Now switch to the newly created GOROOT
os.Setenv("GOROOT", output)

Expand Down

0 comments on commit 94ca818

Please sign in to comment.