-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix invalid error message "no go files to analyze" #1154
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
// Currently, go/packages doesn't guarantee that error will be returned | ||
// if context was cancelled. See | ||
// https://github.com/golang/tools/commit/c5cec6710e927457c3c29d6c156415e8539a5111#r39261855 | ||
if ctx.Err() != nil { |
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.
Perhaps:
if err := ctx.Err(); err != nil {
would do? It would allow to avoid calling ctx.Err()
twice.
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.
I don't see any profit to save nanoseconds here :)
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.
update: maybe microseconds
func (c *cancelCtx) Err() error {
c.mu.Lock()
err := c.err
c.mu.Unlock()
return err
}
It doesn't make sense to waste time on such micro-optimization, there are a lot of things to save seconds of time
pkg/lint/load.go
Outdated
// if context was cancelled. See | ||
// https://github.com/golang/tools/commit/c5cec6710e927457c3c29d6c156415e8539a5111#r39261855 | ||
if ctx.Err() != nil { | ||
return nil, errors.Wrap(ctx.Err(), "timeouted to load packages") |
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.
timeout
is misspelled
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.
thank you, fixed
In case of timeouts of go/packages loading we could return such error. Relates: #825
aa8137f
to
d5f7501
Compare
In case of timeouts of go/packages loading
we could return such error.
Relates: #825