I have the following code from page one in the go tour:

package main import "fmt" func main() { fmt.Println("Hello, 世界") } 

I saved the file in Sublime 3 with the name goTour and as the type go. When I build, I get:

go run: no go files listed [Finished in 0.3s with exit code 1] [cmd: go run C:\Users\new customer\Desktop\goTour] [dir: C:\Users\new customer\Desktop] [path: C:\Windows\System32\;"C:\Program Files\Java\jdk1.7.0_25"\bin;C:\devtools\apache-maven-3.0.5\bin;C:\Program Files\TortoiseHg;C:\Python34;C:\Go\bin] 

Has anyone else experienced this problem or know how to solve it? I have installed go and gosublime.

4 Answers

With main() function present in .go file within project's root, this works for me:

$ go run . 

Save the file as tour.go (mind the extension .go).

The command sublime tries to run is

go run C:\Users\new customer\Desktop\goTour 

So it obviously does not have the right extension. The type in sublime does not really matter.

My Working Environment is Ubuntu 14.04.

My Working Directory Structure.

$HOME/go/src -> for storing tour.go file

$HOME/go/bin -> for storing tour executable file

I am hoping that you are in the present working "src" directory in your terminal. Then the command will be:

$ go run tour.go 

If you want to run/execute compiled file then use this command:

$ $HOME/go/bin/tour 

In GoSublime, all I did was under the package directory with 9o prompt (#) and type:

 run 

to run my code... this is what it looks like:

[ ~/Documents/software/go_tests/src/hello/ ] # run hello, world [ `run` | done: 1.767649ms ] 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy