Can't run go file with go run (filename)
To run the .go file and not the compiled binary, you need to give go run the relative source file path. Try:

go run src/main.go


To compile the go program into a binary executable, use:

go build src/main.go


This will work if...


go can be found; test this with the command which go. Does it return a path to go?
Your GOPATH environment is set appropriately; test this with echo $GOPATH. Does it return the project directory? See go wiki page on GOPATH for advice.


Break Down the Problem

Open a new Terminal.app window. This will discard previous export commands that may be causing confusion.

Test go can be found. Use which go to ensure the binary is available. If not, fix this with an export command.

Check the directory structure of your project. Make sure no names are mispelt and your .go files have the correct suffix. The Finder may be hiding the true suffix. Does ls -lR list the contents you expect?

Check you are in the right directory. The go commands need to be executed from within the project directory. Use pwd to see what directory you are in? Is it the project directory gocode/? If not, use a cd command to fix this.

Project Layout

Let's assume your file structure follows the minimal go convention:

gocode/
gocode/bin/
gocode/src/
gocode/src/main.go


The three separate commands to run main.go would be:

cd gocode
export GOPATH=$PWD
go run src/main.go


This will run the main function within main.go. To build an executable suitable for distribution, use the command go build src/main.go.

Managing GOPATH Directories

With regard to managing gopaths and projects, I have had success with Herbert Fischer's Manage multiple GOPATH dirs with ease approach.