Recently I found that Revel is a really good MVC web framework, and I want to try it out. The problem is that I'm new to Go and everything seems a little different.
When using PHP, I just put files into /var/www/
folder, or use some IDE, then I can open browser and test them live. It's even easier with RoR or Node.js, I just go to local project folder (doesn't matter where), run one command in terminal and already can see the result on localhost:3000
.
This way, I have the following structure on my local machine:
home
└── mark
└── code
├── php
│ └── my_php_app
└── ruby
└── my_ruby_app
They all are synced via git. Then, when I want to deploy on my remote machine, I just pull them into /var/www/
and set up Apache2/Nginx
But how do I do this with Go apps? I installed Go both on my Linux machine at home, and on my VPS. When I open ~/code/go/mygoapp
and try to run it with revel run
, it says that it's not found in GOPATH
. So, I assume, I need to keep all my Go projects separately from my other projects, in GOPATH
, which could be /usr/local/go/src/
or ~/gocode/src/
.
Questions are:
-
What should I do, if I want to keep all my Go/Revel projects in
go
folder along withphp
andruby
on local machine like that:home └── mark └── code ├── go │ └── my_revel_app ├── php │ └── my_php_app └── ruby └── my_ruby_app
And how do I actually deploy them on my remote server the correct way?
If I still need to use GOPATH for that, how do I name the packages? Is it
GOPATH/src/mygoapp
,GOPATH/src/mark/mygoapp
orGOPATH/src/bitbucket.org/mark/mygoapp
(while this repo is private)?
I know, this could be a noob question, but I don't see a logic here. Even with simple Go programs, I don't need to put them to GOPATH in order to run.