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
```
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

View File

@ -98,6 +98,16 @@ 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'" \
--watch .
```
Ignore watch over all test files:
> 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"
)
var Version string
func main() {
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
@ -16,6 +18,6 @@ func main() {
log.Fatal("Forced failure")
})
log.Println("Starting server")
log.Println("Starting server: Version", Version)
log.Fatal(http.ListenAndServe(":8080", nil))
}