Skip to content

Commit 7f381c7

Browse files
committed
Add example for custom configurations
1 parent 2a09c4e commit 7f381c7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ make setup
2828
### Running gaper in development
2929

3030
```
31-
make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server
31+
make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server --build-args="-ldflags=\"-X 'main.Version=v1.0.0'\""
3232
```
3333

3434
### Running lint

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ Using all defaults provided by Gaper:
9898
gaper
9999
```
100100

101+
Example providing a few custom configurations:
102+
103+
```
104+
gaper \
105+
--bin-name build/api-dev \
106+
--build-path cmd/server \
107+
--build-args "-ldflags=\"-X 'main.Version=dev'" \
108+
--watch .
109+
```
110+
101111
Ignore watch over all test files:
102112

103113
> no need for this if you have not disabled the default ignore settings `--disable-default-ignore`

testdata/server/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"net/http"
88
)
99

10+
var Version string
11+
1012
func main() {
1113
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
1214
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
@@ -16,6 +18,6 @@ func main() {
1618
log.Fatal("Forced failure")
1719
})
1820

19-
log.Println("Starting server")
21+
log.Println("Starting server: Version", Version)
2022
log.Fatal(http.ListenAndServe(":8080", nil))
2123
}

0 commit comments

Comments
 (0)