stretchr / goweb

A lightweight RESTful web framework for Go
632 stars 61 forks source link

The server's binary gets all the test flags #72

Open oleksandr opened 10 years ago

oleksandr commented 10 years ago

I've noticed weird flags appear when I print the -help of my binary:

Usage of app/bin/server: -conf="etc/config.yml": Configuration file -ip="0.0.0.0": IP address to bind server to. Example: 127.0.0.1 -port=8080: Port number to bind server to. Example: 8080 -test.bench="": regular expression to select benchmarks to run -test.benchmem=false: print memory allocations for benchmarks -test.benchtime=1s: approximate run time for each benchmark -test.blockprofile="": write a goroutine blocking profile to the named file after execution -test.blockprofilerate=1: if >= 0, calls runtime.SetBlockProfileRate() -test.cpu="": comma-separated list of number of CPUs to use for each test -test.cpuprofile="": write a cpu profile to the named file during execution -test.memprofile="": write a memory profile to the named file after execution -test.memprofilerate=0: if >=0, sets runtime.MemProfileRate -test.parallel=1: maximum test parallelism -test.run="": regular expression to select tests and examples to run -test.short=false: run smaller test suite to save time -test.timeout=0: if positive, sets an aggregate time limit for all tests -test.v=false: verbose: print additional output

As far as I can see from:

$ go list -f '{{join .Deps "\n"}}' github.com/stretchr/goweb | grep testing testing

Goweb can be the reason... Any ideas how to get rid of these flags?

tylerstillwater commented 10 years ago

It looks like test_helper.go imports testing. That may be causing it.

On Nov 25, 2013, at 2:14 PM, Oleksandr Lobunets notifications@github.com wrote:

I've noticed weird flags appear when I print the -help of my binary:

Usage of app/bin/server: -conf="etc/config.yml": Configuration file -ip="0.0.0.0": IP address to bind server to. Example: 127.0.0.1 -port=8080: Port number to bind server to. Example: 8080 -test.bench="": regular expression to select benchmarks to run -test.benchmem=false: print memory allocations for benchmarks -test.benchtime=1s: approximate run time for each benchmark -test.blockprofile="": write a goroutine blocking profile to the named file after execution -test.blockprofilerate=1: if >= 0, calls runtime.SetBlockProfileRate() -test.cpu="": comma-separated list of number of CPUs to use for each test -test.cpuprofile="": write a cpu profile to the named file during execution -test.memprofile="": write a memory profile to the named file after execution -test.memprofilerate=0: if >=0, sets runtime.MemProfileRate -test.parallel=1: maximum test parallelism -test.run="": regular expression to select tests and examples to run -test.short=false: run smaller test suite to save time -test.timeout=0: if positive, sets an aggregate time limit for all tests -test.v=false: verbose: print additional output

As far as I can see from:

$ go list -f '{{join .Deps "\n"}}' github.com/stretchr/goweb | grep testing testing

Goweb can be the reason... Any ideas how to get rid of these flags?

— Reply to this email directly or view it on GitHub.

matryer commented 10 years ago

How very weird.

Sent from my iPhone

On Nov 25, 2013, at 2:14 PM, Oleksandr Lobunets notifications@github.com wrote:

I've noticed weird flags appear when I print the -help of my binary:

Usage of app/bin/server: -conf="etc/config.yml": Configuration file -ip="0.0.0.0": IP address to bind server to. Example: 127.0.0.1 -port=8080: Port number to bind server to. Example: 8080 -test.bench="": regular expression to select benchmarks to run -test.benchmem=false: print memory allocations for benchmarks -test.benchtime=1s: approximate run time for each benchmark -test.blockprofile="": write a goroutine blocking profile to the named file after execution -test.blockprofilerate=1: if >= 0, calls runtime.SetBlockProfileRate() -test.cpu="": comma-separated list of number of CPUs to use for each test -test.cpuprofile="": write a cpu profile to the named file during execution -test.memprofile="": write a memory profile to the named file after execution -test.memprofilerate=0: if >=0, sets runtime.MemProfileRate -test.parallel=1: maximum test parallelism -test.run="": regular expression to select tests and examples to run -test.short=false: run smaller test suite to save time -test.timeout=0: if positive, sets an aggregate time limit for all tests -test.v=false: verbose: print additional output

As far as I can see from:

$ go list -f '{{join .Deps "\n"}}' github.com/stretchr/goweb | grep testing testing

Goweb can be the reason... Any ideas how to get rid of these flags?

— Reply to this email directly or view it on GitHub.

oleksandr commented 10 years ago

We had the same issue internally in the code, but once eliminated I started suspecting one of the external dependencies. Goweb that was...

matryer commented 10 years ago

@tylerb should test_helper.go get renamed or moved to another package?

tylerstillwater commented 10 years ago

If it ends in _test, it won't be linked into the final binary.

Sent from my iPhone

On Nov 25, 2013, at 7:05 PM, Mat Ryer notifications@github.com wrote:

@tylerb should test_helper.go get renamed or moved to another package?

— Reply to this email directly or view it on GitHub.