-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
build(deps): bump github.com/junk1tm/musttag from 0.4.5 to 0.5.0 #3624
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
Conversation
@junk1tm Windows is not a friend 😄 I recommend adding Windows and macOS to your CI. |
It's a bit weird to have a path inside a report message (ex: Can you remove it from your linter? |
It's actually the path of the function call to which the reported type is passed, not the same path as in the report itself, e.g. 10 var user User
11 json.Marshal(user) // <- this one
I found it quite useful because it helps to understand why the type was reported in the first place. And sometimes the call is located far away, may be in a different package too. WDYT? |
I believe we can fix the Windows tests using build tags 🤔 |
I think a regexp can do the job instead of build tags |
I understand, and this can be useful, but the info is not as accurate as one might expect: package main
import (
"encoding/json"
)
type User struct {
Firstname string
Lastname string
}
func main() {
var user User
foo(user)
bar(user)
_, _ = json.Marshal(user)
_, _ = json.Marshal(user)
}
func foo(user User) {
_, _ = json.Marshal(user)
}
func bar(user User) {
_, _ = json.Marshal(user)
} $ ./golangci-lint run -Emusttag
foo.go:7:6: `User` should be annotated with the `json` tag as it is passed to `json.Marshal` at foo.go:18:9 (musttag)
type User struct {
^ The more I think the more I wonder if the position of the reports shouldn't be the calls to |
I fixed the problem with the vulnerability scanner in the master branch, can you rebase? |
WDYT about #3624 (comment) ? |
You're right, sometimes I forget that these comments are actually regexp 😅
Could you elaborate on why the info is not accurate? It contains the function name and the line number, not sure if there is anything to add.
I had the same thoughts but in the end I decided that the primary report location should be the error itself: it's the type declaration that should be fixed (by annotating with tags), not the corresponding function call. |
Maybe we should leave it in the current state for now and wait for more feedback? |
In my example there 4 calls to |
The issue about reporting struct outside of the module leads me to think that knowing that a struct will be marshaled without the expected tag can also be a piece of important information. I'm just thinking. There are no blockers here, just some thoughts. |
Currently it's the result of I appreciate your thoughts and ideas, helps a lot 👍 |
The linter reports the struct but it produces multiple reports related to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but we can continue to discuss.
go-simpler/musttag@v0.4.5...v0.5.0