mirror of https://github.com/maxcnunes/gaper.git
Add example for custom configurations
This commit is contained in:
parent
2a09c4e713
commit
7f381c7e58
|
@ -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
|
||||||
|
|
10
README.md
10
README.md
|
@ -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`
|
||||||
|
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue