Go version

go version go1.22.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/codespace/.cache/go-build'
GOENV='/home/codespace/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/workspaces/godm/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build184102273=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Create a binary with output of the following function:-

import (
    "os"
)
func getCurrentBinaryName() string {
    currentBinaryPath, err := os.Executable()
    if err != nil {
        println("Error getting current binary path:", err)
        os.Exit(1)
    }
    return currentBinaryPath
}

Put the binary in a path to make it have space in filepath (either rename the binary or the parent folder path).

What did you see happen?

If filepath is say /workspaces/myapp/bin 2/myapp it will return /workspaces/myapp/bin.

Have observed this happening with windows and linux path resolution. Not sure about mac.

What did you expect to see?

The actual path as is the case if the filepath don't contain space.

Comment From: sansmoraxz

Opps it was issue with some other library