Add example for custom configurations

This commit is contained in:
Max Claus Nunes 2021-12-18 07:28:48 -03:00
parent 2a09c4e713
commit 7f381c7e58
3 changed files with 14 additions and 2 deletions

View File

@ -28,7 +28,7 @@ make setup
### Running gaper in development ### Running gaper in development
``` ```
make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server --build-args="-ldflags=\"-X 'main.Version=v1.0.0'\""
``` ```
### Running lint ### Running lint

View File

@ -98,6 +98,16 @@ Using all defaults provided by Gaper:
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'" \
--watch .
```
Ignore watch over all test files: Ignore watch over all test files:
> no need for this if you have not disabled the default ignore settings `--disable-default-ignore` > no need for this if you have not disabled the default ignore settings `--disable-default-ignore`

View File

@ -7,6 +7,8 @@ import (
"net/http" "net/http"
) )
var Version string
func main() { func main() {
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
@ -16,6 +18,6 @@ func main() {
log.Fatal("Forced failure") log.Fatal("Forced failure")
}) })
log.Println("Starting server") log.Println("Starting server: Version", Version)
log.Fatal(http.ListenAndServe(":8080", nil)) log.Fatal(http.ListenAndServe(":8080", nil))
} }