-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
type/bugFound something you weren't expecting? Report it here!Found something you weren't expecting? Report it here!
Description
test_helpers.go is built with the package. It should be built only when testing which means it should have the suffix _test.go. One side effect is that is that by test_helpers.go using httptest every program that uses gin gets -httptest.serve flag.
package main
import (
"flag"
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
rtr := gin.Default()
rtr.GET("/", func(ctx *gin.Context) {
ctx.String(http.StatusOK, "Hi")
})
flag.Parse()
rtr.Run(":8080")
}Now run the program with --help and you'll see:
$ go run /tmp/t.go --help
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET / --> main.main.func1 (3 handlers)
Usage of /tmp/go-build903640301/command-line-arguments/_obj/exe/t:
-httptest.serve string
if non-empty, httptest.NewServer serves on this address and blocks
exit status 2
$
Metadata
Metadata
Assignees
Labels
type/bugFound something you weren't expecting? Report it here!Found something you weren't expecting? Report it here!