Repository: mccutchen/go-httpbin
Pull request #101 (2022-11-13 16:44:17)

cmd: fix help output
Fix a small regression in #98, best illustrated by this diff:

```diff
--- help.before	2022-11-13 11:43:51.000000000 -0500
+++ help.after	2022-11-13 11:43:56.000000000 -0500
@@ -1,4 +1,4 @@
-Usage:
+Usage of go-httpbin:
   -allowed-redirect-domains string
     	Comma-separated list of domains the /redirect-to endpoint will allow
   -host string
```

codecov-commenter: # [Codecov](https://codecov.io/gh/mccutchen/go-httpbin/pull/101?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen) Report
> Merging [#101](https://codecov.io/gh/mccutchen/go-httpbin/pull/101?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen) (393a739) into [main](https://codecov.io/gh/mccutchen/go-httpbin/commit/95fdb991cf9ea8e467e7a3300895a26cc1a03abd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen) (95fdb99) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##             main     #101   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files           7        7           
  Lines        1020     1020           
=======================================
  Hits         1007     1007           
  Misses          8        8           
  Partials        5        5           
```

| [Impacted Files](https://codecov.io/gh/mccutchen/go-httpbin/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen) | Coverage Δ | |
|---|---|---|
| [httpbin/cmd/cmd.go](https://codecov.io/gh/mccutchen/go-httpbin/pull/101/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Will+McCutchen#diff-aHR0cGJpbi9jbWQvY21kLmdv) | `93.45% <100.00%> (ø)` | |


Patch:
diff --git a/httpbin/cmd/cmd.go b/httpbin/cmd/cmd.go
index 97d6736..c006dc0 100644
--- a/httpbin/cmd/cmd.go
+++ b/httpbin/cmd/cmd.go
@@ -131,7 +131,7 @@ func (e ConfigError) Error() string {
 func loadConfig(args []string, getEnv func(string) string, getHostname func() (string, error)) (*config, error) {
 	cfg := &config{}
 
-	fs := flag.NewFlagSet("", flag.ContinueOnError)
+	fs := flag.NewFlagSet("go-httpbin", flag.ContinueOnError)
 	fs.BoolVar(&cfg.rawUseRealHostname, "use-real-hostname", false, "Expose value of os.Hostname() in the /hostname endpoint instead of dummy value")
 	fs.DurationVar(&cfg.MaxDuration, "max-duration", httpbin.DefaultMaxDuration, "Maximum duration a response may take")
 	fs.Int64Var(&cfg.MaxBodySize, "max-body-size", httpbin.DefaultMaxBodySize, "Maximum size of request or response, in bytes")


Test patch:
diff --git a/httpbin/cmd/cmd_test.go b/httpbin/cmd/cmd_test.go
index 146cfe2..5ce96cd 100644
--- a/httpbin/cmd/cmd_test.go
+++ b/httpbin/cmd/cmd_test.go
@@ -14,7 +14,7 @@ import (
 
 // To update, run:
 // make && ./dist/go-httpbin -h 2>&1 | pbcopy
-const usage = `Usage:
+const usage = `Usage of go-httpbin:
   -allowed-redirect-domains string
     	Comma-separated list of domains the /redirect-to endpoint will allow
   -host string