gin (forked from gin )
gin
is a simple command line utility for live-reloading Go web applications.
Just run gin
in your app directory and your web app will be served with
gin
as a proxy. gin
will automatically recompile your code when it
detects a change. Your app will be restarted the next time it receives an
HTTP request.
gin
adheres to the "silence is golden" principle, so it will only complain
if there was a compiler error or if you succesfully compile after an error.
-
my main go file is under src/main/main.go. Normally I use
go build -o bin/main main
which is not workable under the origianl gin. -
Monitor all files under
src
folder. -
Monitor not only
.go
file, but also.tmpl
file.
Thus I modified the command input a bit, in order to be able to pass the folder name for building and the src for watching any changes.
========
Assuming you have a working Go environment and GOPATH/bin
is in your
PATH
, gin
is a breeze to install:
go get github.com/stefanzan/gin
Then verify that gin
was installed correctly:
gin -h
How to use it ? (2015/09/05)
You can modify the run.sh
to feed your own needs. Basically,
gin -a "8000" -p "3000" -m "main"
main
is a folder under src
folder, in which there is a main file named main.go
.
gin
assumes that your web app binds itself to the PORT
environment
variable so it can properly proxy requests to your app. Web frameworks
like Martini do this out of
the box.
When you normally start your server with flags
if you want to override any of them when running gin
we suggest you
instead use github.com/namsral/flag
as explained in this post