https://github.com/n3integration/reload
Live reload utility for Go web servers
https://github.com/n3integration/reload
golang livereload tooling
Last synced: 2 months ago
JSON representation
Live reload utility for Go web servers
- Host: GitHub
- URL: https://github.com/n3integration/reload
- Owner: n3integration
- License: mit
- Created: 2018-06-09T16:58:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-22T01:46:35.000Z (almost 8 years ago)
- Last Synced: 2024-06-20T10:15:33.372Z (about 2 years ago)
- Topics: golang, livereload, tooling
- Language: Go
- Homepage:
- Size: 199 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Reload [ ](https://app.codeship.com/projects/293485)
[](https://codecov.io/gh/n3integration/reload)
========
`reload` is a fork of the [gin](https://github.com/codegangsta/gin) project
originally written by [Jeremy Saenz](https://github.com/codegangsta).
`reload` is a command line utility for live-reloading Go web applications.
Just run `reload` in your app directory and your web app will be served with
`reload` as a proxy. `reload` will automatically recompile your code when it
detects a change. Your app will be restarted the next time it receives an
HTTP request (unless the `--immediate` flag is passed).
`reload` adheres to the "silence is golden" principle, so it will only complain
if there was a compiler error or if you successfully compile after an error.
## Installation
Assuming you have a working Go environment and `GOPATH/bin` is in your
`PATH`, `reload` is a breeze to install:
```shell
go get -u github.com/n3integration/reload
```
Then, verify that `reload` was installed correctly:
```shell
reload -h
```
## Basic usage
```shell
reload [options] run main.go
```
Options
```
--laddr value, -l value listening address for the proxy server
--port value, -p value port for the proxy server (default: 3000)
--appPort value, -a value port for the Go web server (default: 3001)
--bin value, -b value name of generated binary file (default: "gin-bin")
--path value, -t value Path to watch files from (default: ".")
--build value, -d value Path to build files from (defaults to same value as --path)
--excludeDir value, -x value Relative directories to exclude
--immediate, -i run the server immediately after it's built
--all reloads whenever any file changes, as opposed to reloading only on .go file change
--buildArgs value Additional go build arguments
--certFile value TLS Certificate
--keyFile value TLS Certificate Key
--logPrefix value Setup custom log prefix
--notifications enable desktop notifications
--help, -h show help
--version, -v print the version
```
## Supporting Reload in Your Web App
`reload` assumes that your web app binds itself to the `PORT` environment
variable so it can properly proxy requests to your app.
## Using flags?
When you normally start your server with [flags](https://godoc.org/flag)
if you want to override any of them when running `reload` we suggest you
instead use [github.com/namsral/flag](https://github.com/namsral/flag)
as explained in [this post](http://stackoverflow.com/questions/24873883/organizing-environment-variables-golang/28160665#28160665)