Browse Source

fix running go with absolute paths.

Lucas Stadler 11 years ago
parent
commit
ed725ced5d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      go/qst.go

+ 4 - 1
go/qst.go

29
var mappings = map[string]func(string) string{
29
var mappings = map[string]func(string) string{
30
	".go": func(name string) string {
30
	".go": func(name string) string {
31
		outpath := strings.TrimSuffix(name, path.Ext(name))
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
	".rb": func(name string) string {
37
	".rb": func(name string) string {
35
		return fmt.Sprintf("ruby %s", name)
38
		return fmt.Sprintf("ruby %s", name)