ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - maxcnunes/gaper: Builds and restarts a Go project when it crashes or some watched file changes
Builds and restarts a Go project when it crashes or some watched file changes - maxcnunes/gaper
Visit Site

GitHub - maxcnunes/gaper: Builds and restarts a Go project when it crashes or some watched file changes

GitHub - maxcnunes/gaper: Builds and restarts a Go project when it crashes or some watched file changes


Software License Linux - Build Status Windows - Build status Coverage Status Go Doc Go Report Card Powered By: GoReleaser

Changelog

See Releases for detailed history changes.

Installation

Using go tooling:

go get -u github.com/maxcnunes/gaper/cmd/gaper

Or, downloading the binary instead (example for version 1.1.0, make sure you are using the latest version though):

curl -SL https://github.com/maxcnunes/gaper/releases/download/v1.1.0/gaper_1.1.0_linux_amd64.tar.gz | tar -xvzf - -C "${GOPATH}/bin"

Usage

NAME:
   gaper - Used to build and restart a Go project when it crashes or some watched file changes

USAGE:
   gaper [global options] command [command options] [arguments...]

VERSION:
   version

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --bin-name value                 name for the binary built by gaper for the executed program (default current directory name)
   --build-path value               path to the program source code (default: ".")
   --build-args value               arguments used on building the program
   --program-args value             arguments used on executing the program
   --verbose                        turns on the verbose messages from gaper
   --disable-default-ignore         turns off default ignore for hidden files and folders, "*_test.go" files, and vendor folder
   --watch value, -w value          list of folders or files to watch for changes
   --ignore value, -i value         list of folders or files to ignore for changes
   --poll-interval value, -p value  how often in milliseconds to poll watched files for changes (default: 500)
   --extensions value, -e value     extensions to watch for changes (default: "go")
   --no-restart-on value, -n value  don't automatically restart the supervised program if it ends:
                                      if "error", an exit code of 0 will still restart.
                                      if "exit", no restart regardless of exit code.
                                      if "success", no restart only if exit code is 0.
   --help, -h                       show help
   --version, -v                    print the version

Watch and Ignore paths

For those options Gaper supports static paths (e.g. build/, seed.go) or glob paths (e.g. migrations/**/up.go, *_test.go).

On using a path to a directory please add a / at the end (e.g. build/) to make sure Gaper won't include other matches that starts with that same value (e.g. build/, build_settings.go).

Default ignore settings

Since in most projects there is no need to watch changes for:

  • hidden files and folders
  • test files (*_test.go)
  • vendor folder

Gaper by default ignores those cases already. Although, if you need Gaper to watch those files anyway it is possible to disable this setting with --disable-default-ignore argument.

Watch method

Currently Gaper uses polling to watch file changes. We have plans to support fs events though in a near future.

Examples

Using all defaults provided by Gaper:

gaper

Example providing a few custom configurations:

gaper \
    --bin-name build/api-dev \
    --build-path cmd/server \
    --build-args "-ldflags=\"-X 'main.Version=dev'" \
    -w 'public/**' -w '*.go' \
    -e js -e css -e html \
    --ignore './**/*_mock.go' \
    --program-args "-arg1 ok -arg2=nope" \
    --watch .

Contributing

See the Contributing guide for steps on how to contribute to this project.

Reference

This package was heavily inspired by gin and node-supervisor.

Basically, Gaper is a mixing of those projects above. It started from gin code base and I rewrote it aiming to get something similar to node-supervisor (but simpler). A big thanks for those projects and for the people behind it! :clap::clap:

How is Gaper different of Gin

The main difference is that Gaper removes a layer of complexity from Gin which has a proxy running on top of the executed server. It allows to postpone a build and reload the server when the first call hits it. With Gaper we don't care about that feature, it just restarts your server whenever a change is made.

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory