diff options
| author | Shulhan <ms@kilabit.info> | 2018-11-30 12:03:50 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-11-30 12:03:50 +0700 |
| commit | 3d9c2dd6541c076ae6bc09ab1db227521864b0d3 (patch) | |
| tree | 45de62474bccc567f0f559cc3735d0c3797e79b0 /lib/test | |
| parent | b73bf53f451bb71d59c6e502f92f5492659b2d00 (diff) | |
| download | pakakeh.go-3d9c2dd6541c076ae6bc09ab1db227521864b0d3.tar.xz | |
all: minimize and suppress linter warnings for global variables
Diffstat (limited to 'lib/test')
| -rw-r--r-- | lib/test/mock/mock.go | 2 | ||||
| -rw-r--r-- | lib/test/test.go | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/test/mock/mock.go b/lib/test/mock/mock.go index 69799bf9..89dd1c32 100644 --- a/lib/test/mock/mock.go +++ b/lib/test/mock/mock.go @@ -12,7 +12,7 @@ import ( "os" ) -var ( +var ( // nolint: gochecknoglobals _stderr *os.File _stdin *os.File _stdout *os.File diff --git a/lib/test/test.go b/lib/test/test.go index 19734807..19ec4325 100644 --- a/lib/test/test.go +++ b/lib/test/test.go @@ -14,11 +14,7 @@ import ( "testing" ) -var ( - trace = make([]byte, 1024) -) - -func printStackTrace(t testing.TB) { +func printStackTrace(t testing.TB, trace []byte) { var ( lines = 0 start = 0 @@ -49,9 +45,10 @@ func printStackTrace(t testing.TB) { // func Assert(t *testing.T, name string, exp, got interface{}, equal bool) { if reflect.DeepEqual(exp, got) != equal { + trace := make([]byte, 1024) runtime.Stack(trace, false) - printStackTrace(t) + printStackTrace(t, trace) t.Fatalf(">>> Expecting %s,\n"+ "'%+v'\n"+ @@ -70,9 +67,10 @@ func Assert(t *testing.T, name string, exp, got interface{}, equal bool) { // func AssertBench(b *testing.B, name string, exp, got interface{}, equal bool) { if reflect.DeepEqual(exp, got) != equal { + trace := make([]byte, 1024) runtime.Stack(trace, false) - printStackTrace(b) + printStackTrace(b, trace) b.Fatalf("\n"+ ">>> Expecting %s '%+v'\n"+ |
