#9 incomplete import detection for tests
Opened 3 years ago by nim. Modified 3 years ago

$ golist --imported --package-path github.com/sirupsen/logrus --skip-self --tests

only outputs

github.com/stretchr/testify/assert

for sirupsen logrus, when the terminal_check_notappengine.go test imports

golang.org/x/crypto/ssh/terminal

Aren't Go tests in files that end with _test.go? Since terminal_check_notappengine.go is not one of those, it shouldn't be output with --tests. It is output in the normal (no --tests) results.

golist does not uses this kind or regexes if I understand things correctly it plugs directly in the Go compiler inner code to match the Go compiler view of what's in a project (@jchaloup would have more information). This was a deliberate choice by Fedora Go maintainers last year, my initial macro implementation just performed regexes in shell scripts.

So golist results should be more correct that what you would expect naïvely from a human file path analysis.

Unfortunately that also assumes the integration with Go compiler rules is correct and complete. For example golist would initially parse files starting with underscores, even though the Go spec says it should not, I suppose because Google implemented '_' in some other place of its codebase.

So basically, it's not as clear cut as that, this issue needs investigating why the golist code thinks this file is a test file, and whether this is correct WRT the Go language spec, and not superseeded by some other exception golist does not implement.

What I'm saying is that golist does not think it's a test file, and I'm confused why you think it should be.

Metadata Update from @nim:
- Issue assigned to nim

3 years ago

Ah ok. I think that's because we only hit it when executing tests. Will look at it once more, maybe the logrus code was refactored since this was filed

Login to comment on this ticket.

Metadata