Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add
gofactory
linter #4196base: master
Are you sure you want to change the base?
Add
gofactory
linter #4196Changes from all commits
bbe0eb9
70cd3e5
5a86fb8
2a31b53
22e29b7
faecc6b
2fde9ce
bb4065b
419bf43
e40eddf
930e2b2
c1195cf
ba1ed19
2b59b9d
eb43dd5
df588bc
a1dbfe1
985e045
111f638
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 hope that is correct solution to pass tests.
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.
your tests are not in the right places.
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.
Do you mean I should move
test/testdata/gofactory/blocked.go
totest/testdata/gofactory/gofactory_package_globs_only.go
?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.
no, your tests must be inside
test/testdata/
and not a dedicated folder.and your linter should be removed from
test/linters_test.go
.#4196 (comment)
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.
need to rollback
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 added because of linter error
Use factory for unsafe.Pointer
.Should I add option to exclude checking of std libraries in gofactory?
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.
Nice idea, but I think in case of
exclude-std=false
we will receive false positive anyway, because a lot of std types could be (or must be) used without factory by design. Likeunsafe.Pointer
orsync.Mutex
.Zero value is useful 🙂
Look at
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.
how does this change relate to PR?
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.
If I return, can I add
-D gofactory
to fix linter errorUse factory for unsafe.Pointer
.Or is solution from comment is better?
#4196 (comment)
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.
this should be reverted.
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.
cosmetic question: why not
Use factory for alias_blocked.Request
?at fist time I was confused, but cannot decide what option is better 🤔
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.
Idk too)
Could you decide how to better based on your experience?
I checked wrapcheck, go-reassign. They both used different printing way for package names.
I don't find another linter which uses package names.
wrapcheck:
error returned from external package is unwrapped: sig: func encoding/json.Marshal(v any) ([]byte, error)
go-reassign:
reassigning variable EOF in other package alias
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.
IMHO, the option that is better for grep and common understanding – to keep the source code and warnings for it consistent: