gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/gobuild/defaultexe.go (about) 1 package gobuild 2 3 import ( 4 "os" 5 "runtime" 6 7 "gitlab.com/Raven-IO/raven-delve/pkg/logflags" 8 ) 9 10 // DefaultDebugBinaryPath returns an unused file path in the current 11 // directory named 'name' followed by a random string 12 func DefaultDebugBinaryPath(name string) string { 13 pattern := name 14 if runtime.GOOS == "windows" { 15 pattern += "*.exe" 16 } 17 f, err := os.CreateTemp(".", pattern) 18 if err != nil { 19 logflags.DebuggerLogger().Errorf("could not create temporary file for build output: %v", err) 20 if runtime.GOOS == "windows" { 21 return name + ".exe" 22 } 23 return name 24 } 25 r := f.Name() 26 f.Close() 27 return r 28 }