qax-os / goreporter

A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Apache License 2.0
3.13k stars 273 forks source link

Running the reporter from another directory #11

Closed antonsteenvoorden closed 7 years ago

antonsteenvoorden commented 7 years ago

This tool seems very useful and I really wanted to use this. But when trying out this neat tool I ran into a couple of issues.

I had an issue when runningthe reporter from the directory of the project I want to check. I am using Glide as package manager.

When I executed: goreporter -p . -r . -t $GOPATH/src/github.com/wgliang/goreporter/templates/template.html

I got:

[Apollo]2017/04/12 16:37:48 The report path is not specified, and the current path is used by default
[Apollo]2017/04/12 16:37:48 There are no packages that are excepted, review all items of the package
[Apollo]2017/04/12 16:37:48 start code quality assessment...
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.DirList.func1(0xc4202bb9a0, 0x19, 0x18d4160, 0xc42032fc70, 0x0, 0x0, 0x0, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/utils.go:30 +0x216
path/filepath.walk(0xc4202bb9a0, 0x19, 0x18d4160, 0xc42032fc70, 0xc4200f14d0, 0x0, 0x0)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:351 +0x81
path/filepath.walk(0x7fff5fbffa9e, 0x1, 0x18d4160, 0xc420107790, 0xc4200f14d0, 0x0, 0x30)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:376 +0x414
path/filepath.Walk(0x7fff5fbffa9e, 0x1, 0xc4200f14d0, 0xc4201076c0, 0x0)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:398 +0x14c
main.DirList(0x7fff5fbffa9e, 0x1, 0x15a6ea3, 0x8, 0x0, 0x0, 0x1043f85, 0x10, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/utils.go:38 +0x1ec
main.(*Reporter).Engine(0xc42015c180, 0x7fff5fbffa9e, 0x1, 0x0, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/engine.go:44 +0x10c
main.main()
    /Users/anton/development/go/src/github.com/wgliang/goreporter/main.go:70 +0x378

Another issue I had was when I ran the goreporter from it's project folder (GitHub.com/wgliang/goreporter) and pointed to my project folder like so: goreporter -p ../../../munisense.com/services/result-aggregation-service-go/ -d ../goreporter -t ./templates/template.html it kept saying that I didn't have these dependencies installed (because I used glide) and that I should install them using go get. Will there be support for vendoring?

Lastly: How can I only check the packages I have built? Not the dependencies? Do I have to list all of the dependencies as exceptions? That seems a bit too much effort.. 😞

Please let me know if I'm doing something wrong here.

EDIT: Using both v1.0.0 and HEAD

wgliang commented 7 years ago

Thank you for these useful questions:

Feedback: goreporter -p . -r . -t $GOPATH/src/github.com/wgliang/goreporter/templates/template.html?

antonsteenvoorden commented 7 years ago

Im still having issues when running the reporter in my project folder when using the command you suggested:

[Apollo]2017/04/24 14:56:23 The report path is not specified, and the current path is used by default
[Apollo]2017/04/24 14:56:23 There are no packages that are excepted, review all items of the package
[Apollo]2017/04/24 14:56:23 start code quality assessment...
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.DirList.func1(0xc4203c7ac0, 0x14, 0x18d4160, 0xc42043bc70, 0x0, 0x0, 0x0, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/utils.go:30 +0x216
path/filepath.walk(0xc4203c7ac0, 0x14, 0x18d4160, 0xc42043bc70, 0xc420101440, 0x0, 0x0)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:351 +0x81
path/filepath.walk(0x7fff5fbffad6, 0x1, 0x18d4160, 0xc42010d790, 0xc420101440, 0x0, 0x30)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:376 +0x414
path/filepath.Walk(0x7fff5fbffad6, 0x1, 0xc420101440, 0xc42010d6c0, 0x0)
    /usr/local/Cellar/go/1.8/libexec/src/path/filepath/path.go:398 +0x14c
main.DirList(0x7fff5fbffad6, 0x1, 0x15a6ea3, 0x8, 0x0, 0x0, 0x1043f85, 0x10, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/utils.go:38 +0x1ec
main.(*Reporter).Engine(0xc420164180, 0x7fff5fbffad6, 0x1, 0x0, 0x0)
    /Users/anton/development/go/src/github.com/wgliang/goreporter/engine.go:44 +0x10c
main.main()
    /Users/anton/development/go/src/github.com/wgliang/goreporter/main.go:70 +0x378

Do you have a solution?