Explorar el Código

fix running go with absolute paths.

Lucas Stadler %!s(int64=11) %!d(string=hace) años
padre
commit
ed725ced5d
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      go/qst.go

+ 4 - 1
go/qst.go

@ -29,7 +29,10 @@ qst hello.go - compiles & runs hello.go
29 29
var mappings = map[string]func(string) string{
30 30
	".go": func(name string) string {
31 31
		outpath := strings.TrimSuffix(name, path.Ext(name))
32
		return fmt.Sprintf("go build -o %s %s && ./%s", outpath, name, outpath)
32
		if !path.IsAbs(outpath) {
33
			outpath = fmt.Sprintf("./%s", outpath)
34
		}
35
		return fmt.Sprintf("go build -o %s %s && %s", outpath, name, outpath)
33 36
	},
34 37
	".rb": func(name string) string {
35 38
		return fmt.Sprintf("ruby %s", name)