how to hot reload for golang web application

how to hot reload for golang web application

There are tons of ways to hot reload a golang web application or golang program.

I choose gin to do the hot reload.

Firstly install the gin in GOPATH/bin:

go get github.com/codegangsta/gin

Basic usage

If we run a gin( the same name, but it is the web framework gin) web application which is listening to 8080, we can run this command as below:

go run main.go —port=8088 —appPort=8080

The “—port “ mean the gin proxy server would listen to the port.And the “—appPort” is the port for the Go web server, in this case, we listen to 8080.