Skip to content
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

Matchers: Error annotations catch things that are not errors and not even in Go code #46

Closed
JasonGross opened this issue Mar 23, 2020 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@JasonGross
Copy link

Consider the (totally valid) makefile:

all: foo
	echo Done

include Foo.mk

Foo.mk:
        printf 'foo:\n\techo foo\n' > $@

On the first run of make, this generates

Makefile:4: Foo.mk: No such file or directory
printf 'foo:\n\techo foo\n' > Foo.mk
echo foo
foo
echo Done
Done

There isn't really a good way to suppress this warning (see this StackOverflow question I asked) without massively complicating the Makefile. I don't mind seeing this warning on the first make. However, my github actions go job decides that this is an error (it's not; it's non-fatal), and annotates every single pull request on my repository with an error on the relevant line on the Makefile. Please fix the annotation to not do this.

@bryanmacfarlane
Copy link
Member

I think this action does the right thing. Perhaps the issue is service side which turns output into warning and error annotations. @joshmgross to verify whether there's anything we can do action side.

@bryanmacfarlane bryanmacfarlane added the question Further information is requested label Mar 27, 2020
@JasonGross
Copy link
Author

No, I'm pretty sure this is an issue with your matcher being overzealous:

"regexp": "^([^:]*: )?((.:)?[^:]*):(\\d+)(:(\\d+))?: (.*)$",

This claims that every single output line containing two :s separated by a number an followed by a space is an error in the file that comes before the first colon.

@bryanmacfarlane
Copy link
Member

Ahhh. OK. Thanks @JasonGross

@thboop has another issue on the matcher so maybe he can look at both together.

@bryanmacfarlane bryanmacfarlane assigned thboop and unassigned joshmgross Mar 27, 2020
@bryanmacfarlane bryanmacfarlane added bug Something isn't working and removed question Further information is requested labels Mar 27, 2020
@bryanmacfarlane bryanmacfarlane changed the title Error annotations catch things that are not errors and not even in Go code Matchers: Error annotations catch things that are not errors and not even in Go code Mar 27, 2020
@bryanmacfarlane
Copy link
Member

@JasonGross if it's causing problems there's also a way to disable the problem matcher.

https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers

We added that feature since the scope of a problem matcher is a job and scripts / steps downstream could get false hits.

@bryanmacfarlane
Copy link
Member

I think the solution is to have a much tighter regex for compile errors and then if there's things it misses, problem matchers supports having multiple matchers.

I'll have a PR soon for the v2-beta lineage.

@JasonGross
Copy link
Author

@JasonGross if it's causing problems there's also a way to disable the problem matcher.

https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers

We added that feature since the scope of a problem matcher is a job and scripts / steps downstream could get false hits.

Oh, neat! Thanks! Do you know why this isn't documented at https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md ?

@bryanmacfarlane
Copy link
Member

We can add there. In the meantime, I'm also working on a better solution.

JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 28, 2020
JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 28, 2020
JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 28, 2020
JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 30, 2020
@bryanmacfarlane
Copy link
Member

@JasonGross I have a PR that might help: #48

You can try it out with use: actions/setup-go@matcher

I added tests but it would be great to verify before merging.

@JasonGross
Copy link
Author

@JasonGross
Copy link
Author

Seems to work well, thanks!
image

JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 31, 2020
JasonGross added a commit to JasonGross/fiat-crypto that referenced this issue Mar 31, 2020
JasonGross added a commit to mit-plv/fiat-crypto that referenced this issue Mar 31, 2020
@bryanmacfarlane
Copy link
Member

Thanks for validating. This is now in setup-go@v2-beta and soon to be v2. If you're using the matcher ref from the PR, you may want to update to v2-beta (that won't go away).

JasonGross added a commit to mit-plv/fiat-crypto that referenced this issue Apr 8, 2020
dominikh added a commit to dominikh/setup-go that referenced this issue Jan 16, 2021
Errors reported by Go, even when containing relative paths, do not
always begin with ./ or ../ – for example:

	$ go build ./...
	# honnef.co/go/tools/lintcmd
	lintcmd/format.go:28:8: syntax error: cannot use path := filepath.Clean(pos.Filename) as value

Related, linters commonly used with Go (such as Staticcheck) do not
prefix paths with ./ either.

This change slightly relaxes the stricter pattern that was introduced
as part of v2 to address actions#46. The pattern is still stricter than it
was in v1, and probably as strict as it can be.
dominikh added a commit to dominikh/setup-go that referenced this issue Jan 16, 2021
Errors reported by Go, even when containing relative paths, do not
always begin with ./ or ../ – for example:

	$ go build ./...
	# honnef.co/go/tools/lintcmd
	lintcmd/format.go:28:8: syntax error: cannot use path := filepath.Clean(pos.Filename) as value

Related, linters commonly used with Go (such as Staticcheck) do not
prefix paths with ./ either.

This change slightly relaxes the stricter pattern that was introduced
as part of v2 to address actions#46. The pattern is still stricter than it
was in v1, and probably as strict as it can be.
dominikh added a commit to dominikh/setup-go that referenced this issue Jan 16, 2021
Errors reported by Go, even when containing relative paths, do not
always begin with ./ or ../ – for example:

	$ go build ./...
	# honnef.co/go/tools/lintcmd
	lintcmd/format.go:28:8: syntax error: cannot use path := filepath.Clean(pos.Filename) as value

We could require either ./, ../ or at least one path separator and
still match Go's output. However, commonly used linters (such as
Staticcheck and golint) never use ./ for relative paths. Their output
stopped being matched when we moved from v1 to v2. I believe that
being able to match the output of linters is worth relaxing the
pattern for.

This change slightly relaxes the stricter pattern that was introduced
as part of v2 to address actions#46. However, the pattern is still stricter
than it was in v1 and as strict as it can be for most users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants