You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Executing the go tests fails if a ~/.woke.yaml file is present. This only happens if the tests for woke/cmd are not cached. In order to duplicate with the test cached, run go test -count=1 ./... with a ~/.woke.yaml file in place.
Below is the results from a sample test run on my machine:
Test run with ~/.woke.yaml present
? github.com/get-woke/woke [no test files]
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
--- FAIL: TestInitConfig (0.00s)
--- FAIL: TestInitConfig/no_config (0.00s)
root_test.go:68:
Error Trace: root_test.go:68
Error: Not equal:
expected: ""
actual : "/home/cognitivegears/.woke.yaml"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-
+/home/cognitivegears/.woke.yaml
Test: TestInitConfig/no_config
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.087487,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata/good.yml","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.047839,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.459426,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.064392,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata/good.yml","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.063209,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.230766,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.057834,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.122945,"file":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","file":"../testdata","reason":"file is a directory","time":"2021-11-16T21:01:11-06:00","message":"skipping content"}
{"level":"debug","durationMS":0.019636,"file":"../testdata","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.041956,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052006,"file":"../testdata/whitelist.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052756,"file":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.758427,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"disabling default rules"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.053914,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.121333,"file":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","file":"../testdata","reason":"file is a directory","time":"2021-11-16T21:01:11-06:00","message":"skipping content"}
{"level":"debug","durationMS":0.020675,"file":"../testdata","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.038437,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.04781,"file":"../testdata/whitelist.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052806,"file":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.722755,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.066092,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","durationMS":0.321887,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","durationMS":0.072278,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
--- FAIL: TestRunE (0.00s)
--- FAIL: TestRunE/no_rules_enabled (0.00s)
root_test.go:133:
Error Trace: root_test.go:133
Error: An error is expected but got nil.
Test: TestRunE/no_rules_enabled
root_test.go:134:
Error Trace: root_test.go:134
Error: Target error should be in err chain:
expected: "no rules enabled: either configure rules in your config file or remove the `--disable-default-rules` flag"
in chain:
Test: TestRunE/no_rules_enabled
FAIL
FAIL github.com/get-woke/woke/cmd 0.008s
? github.com/get-woke/woke/cmd/docs [no test files]
ok github.com/get-woke/woke/pkg/config 0.620s
ok github.com/get-woke/woke/pkg/ignore 0.019s
? github.com/get-woke/woke/pkg/output [no test files]
ok github.com/get-woke/woke/pkg/parser 0.012s
ok github.com/get-woke/woke/pkg/printer 0.010s
ok github.com/get-woke/woke/pkg/result 0.006s
ok github.com/get-woke/woke/pkg/rule 0.010s
ok github.com/get-woke/woke/pkg/util 0.002s
ok github.com/get-woke/woke/pkg/walker 0.002s
FAIL
The text was updated successfully, but these errors were encountered:
Thank you for creating the issue!
Please include the following information:
Version of woke
Config file
Go environment
❯ go version && go env
go version go1.16.2 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cognitivegears/.cache/go-build"
GOENV="/home/cognitivegears/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/cognitivegears/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/cognitivegears/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/cognitivegears/Documents/projects/woke/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1090954941=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
Issue: Executing the go tests fails if a
~/.woke.yaml
file is present. This only happens if the tests forwoke/cmd
are not cached. In order to duplicate with the test cached, rungo test -count=1 ./...
with a~/.woke.yaml
file in place.Below is the results from a sample test run on my machine:
Test run with ~/.woke.yaml present
The text was updated successfully, but these errors were encountered: