I have following golang project structure:
- go-projects
- src
- github.com
- user
- my-project
- pack
- pack.go
- main.go
my GOPATH is:
export GOPATH=/home/user/go-projects
I'm trying to call functions from pack package in main.go file and trying to build this project with:
cd my-project
go build && go-install
There is no any output, and also there is no bin directory anywhere. What i did wrong?
UPD This problem was solved. accidently missunderstood file content of main.go and pack.go. But now there is another problem.
How to build correctly this program. When i'm trying to execute go build in /home/user/go-projects/src/github.com/user/my-project i'm getting following erros:
main.go:4:8: cannot find package "github.com/user/pack" in any of:
/home/user/Downloads/go/src/pkg/github.com/user/pack (from $GOROOT)
/home/user/go-projects/src/github.com/user/pack (from $GOPATH)
Thank you
go build,go installruns that as a preliminary step, but it will create a binary if you're in a main package, which could be confusing.