-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)topic/cleanupTopic cleanupTopic cleanup
Description
Including the core import and using the flag import causes the testing imports flags to be included in parsing.
Output
~/s/g/t/tmp $ ./main -h
Usage of ./main:
-flag=10: A flag
-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.coverprofile="": write a coverage profile to the named file after execution
-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.outputdir="": directory in which to write profiles
-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
~/s/g/t/tmp $
Expected output
~/s/g/t/tmp $ ./main -h
Usage of ./main:
-flag=10: A flag
Repo
package main
import (
core "github.com/jbenet/go-ipfs/core"
"flag"
"fmt"
)
func main() {
fake_flag := flag.Int("flag", 10, "A flag")
flag.Parse()
node,_ := core.NewMockNode()
fmt.Println(*fake_flag)
fmt.Println(node)
}As you can see the NewMockNode is included in the core package. This function uses the util/testutil which includes testing.
It would appear that the mock.go file should be mock_test.go as NewMockNode is only used in fuse/ipns/ipns_test.go.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)topic/cleanupTopic cleanupTopic cleanup