1

I have this little Hello World program written in Go:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

I use Sublime Text 3 with GoSublime. Something misconfigured, because Tools -> Build command not working, just only when I type in the console:

go build

Then the editor creating the .exe program.

So I want to use a basic .bat file, where I drag and drop my hello.go program:

@echo off
cd /d "%~dp0"
start "" "C:\Go\bin\go.exe" "run" "%~f1" pause

It runs without problem, but unfortunately closes when it's finished.

Can You help to solve this? ;)

Lanti
  • 2,299
  • 2
  • 36
  • 69

1 Answers1

2

It's just that start launches it in it's own process?

so:

@echo off
cd /d "%~dp0"
C:\Go\bin\go.exe run %~f1 
pause

Should work?

DanG
  • 323
  • 1
  • 9