Skip to content

Print all build errors in a readable way #1636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
torkelrogstad opened this issue Jan 7, 2021 · 2 comments
Closed

Print all build errors in a readable way #1636

torkelrogstad opened this issue Jan 7, 2021 · 2 comments
Labels
enhancement New feature or improvement

Comments

@torkelrogstad
Copy link

Is your feature request related to a problem? Please describe.
When developing, my build is most of the time broken. I often want to identify all non-compiling packages. I can easily do this with go build for my main sources, but this does not work for test sources. I want an easy to use solution to find all my non-compiling tests.

Describe the solution you'd like
If I run golangci-lint run in a directory with several packages where tests can't compile, I want them to be printed to the console in the same way that linter errors are printed.

The functionality is already there: build errors are printed, but only the first error is printed and in a non-easy-to-use format. An example:

I have a file foo_test.go

package foo

import (
	"fmt"
	"testing"
)

func TestFoo(t *testing.T) {
	fmt.Prin()
}

If I now run golangci-lint run, I get this output:

WARN [runner] Can't run linter goanalysis_metalinter: S1021: failed prerequisites: [([email protected]/torkelrogstad/build-tests/foo [github.com/torkelrogstad/build-tests/foo.test], [email protected]/torkelrogstad/build-tests/foo [github.com/torkelrogstad/build-tests/foo.test]): analysis skipped: errors in package: [/Users/torkel/dev/build-tests/foo/foo_test.go:9:6: Prin not declared by package fmt]] 
WARN [runner] Can't run linter unused: buildir: analysis skipped: errors in package: [/Users/torkel/dev/build-tests/foo/foo_test.go:9:6: Prin not declared by package fmt] 
ERRO Running error: buildir: analysis skipped: errors in package: [/Users/torkel/dev/build-tests/foo/foo_test.go:9:6: Prin not declared by package fmt] 

It would be great to get this in the same format as linter errors.

@torkelrogstad torkelrogstad added the enhancement New feature or improvement label Jan 7, 2021
@sumersao
Copy link

sumersao commented Feb 8, 2021

I have this same exact request. Currently, the errors are unbelievably unreadable (I have a lot on a rather large code base I'm not trying to integrate golangci-lint with). I know it's possible to limit the errors, but still this would be really nice

@bombsimon
Copy link
Member

Seems to be duplicate of #1043.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants