Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.10.2 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Jerry\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Work\MyProjects\workspace\go
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
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\Jerry\AppData\Local\Temp\go-build770456046=/tmp/go-build -gno-record-gcc-switches
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.
filepath.Join seems does not work well in Windows, please see the following snippet
package main
import (
"os"
"fmt"
"path/filepath"
)
func main() {
parts := []string {"C:", "Windows", "WinSXS" }
fmt.Println(filepath.Join(parts...))
parts = []string {fmt.Sprintf("C:%c", os.PathSeparator), "Windows", "WinSXS" }
fmt.Println(filepath.Join(parts...))
parts = []string {"C:", "","Program Files", "Microsoft Office 15", "ClientX64" }
fmt.Println(filepath.Join(parts...))
}
filepath.Join is expected to process the path separator properly, it works well for the other parts except the drive letter without the terminating slash. but if there was an empty string in the other parts, it works.
What did you expect to see?
It should output something like the following,
C:\Windows\WinSXS
C:\Windows\WinSXS
C:\Program Files\Microsoft Office 15\ClientX64
What did you see instead?
C:Windows\WinSXS
C:\Windows\WinSXS
C:\Program Files\Microsoft Office 15\ClientX64
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version)?go version go1.10.2 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Jerry\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Work\MyProjects\workspace\go
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
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\Jerry\AppData\Local\Temp\go-build770456046=/tmp/go-build -gno-record-gcc-switches
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.
filepath.Join seems does not work well in Windows, please see the following snippet
package main
import (
"os"
"fmt"
"path/filepath"
)
func main() {
parts := []string {"C:", "Windows", "WinSXS" }
fmt.Println(filepath.Join(parts...))
parts = []string {fmt.Sprintf("C:%c", os.PathSeparator), "Windows", "WinSXS" }
fmt.Println(filepath.Join(parts...))
parts = []string {"C:", "","Program Files", "Microsoft Office 15", "ClientX64" }
fmt.Println(filepath.Join(parts...))
}
filepath.Join is expected to process the path separator properly, it works well for the other parts except the drive letter without the terminating slash. but if there was an empty string in the other parts, it works.
What did you expect to see?
It should output something like the following,
C:\Windows\WinSXS
C:\Windows\WinSXS
C:\Program Files\Microsoft Office 15\ClientX64
What did you see instead?
C:Windows\WinSXS
C:\Windows\WinSXS
C:\Program Files\Microsoft Office 15\ClientX64