Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add gofactory linter #4196

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

Open
maranqz wants to merge 19 commits into golangci:master
base: master
Choose a base branch
Loading
from maranqz:go-factory-lint
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bbe0eb9
1. Added reference
maranqz Nov 12, 2023
70cd3e5
1. Update version after type fixes
maranqz Nov 15, 2023
5a86fb8
1. Added tests in subdir
maranqz Nov 15, 2023
2a31b53
1. Bump golangci-lint version
maranqz Nov 15, 2023
22e29b7
1. Fixed settings name
maranqz Nov 15, 2023
faecc6b
1. Fixed test with config file
maranqz Nov 15, 2023
2fde9ce
1. Update config after linter fixing
maranqz Nov 19, 2023
bb4065b
1. Remove slog to pass go1.20 test
maranqz Nov 20, 2023
419bf43
Merge branch 'master' into go-factory-lint
maranqz Nov 20, 2023
e40eddf
Merge branch 'master' into go-factory-lint
maranqz Nov 26, 2023
930e2b2
1. Added casting function
maranqz Nov 26, 2023
c1195cf
1. renamed linter
maranqz Dec 15, 2023
ba1ed19
Merge branch 'master' into go-factory-lint
maranqz Dec 15, 2023
2b59b9d
1. fixed tests
maranqz Dec 15, 2023
eb43dd5
1. moved gofactory test from dedicated to common directory
maranqz Dec 17, 2023
df588bc
Merge branch 'master' into go-factory-lint
maranqz Dec 17, 2023
a1dbfe1
Merge branch 'master' into go-factory-lint
maranqz Dec 18, 2023
985e045
Merge branch 'master' into go-factory-lint
maranqz Dec 19, 2023
111f638
Merge branch 'master' into go-factory-lint
maranqz Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
1. fixed tests
  • Loading branch information
maranqz committed Dec 15, 2023
commit 2b59b9ddf35e16644927a662ff522a95a8332568
8 changes: 6 additions & 2 deletions test/run_test.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestCgoOk(t *testing.T) {
"--timeout=3m",
"--enable-all",
"-D",
"nosnakecase,gci",
"nosnakecase,gci,gofactory",
Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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 to test/testdata/gofactory/gofactory_package_globs_only.go?

Copy link
Member

@ldez ldez Dec 15, 2023
edited
Loading

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)

Copy link
Contributor

@Antonboom Antonboom Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to rollback

Copy link
Author

@maranqz maranqz Jan 7, 2024

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?

Copy link
Contributor

@Antonboom Antonboom Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add option to exclude checking of std libraries in gofactory?

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. Like unsafe.Pointer or sync.Mutex.

Zero value is useful 🙂

Look at

$ cd $GOROOT/src
$ gofactory -json ./... | jq '.[] | .[] | .[] .message' | sort | uniq

).
WithTargetPath(testdataDir, "cgo").
Runner().
Expand Down Expand Up @@ -355,7 +355,11 @@ func TestLineDirectiveProcessedFiles(t *testing.T) {
func TestUnsafeOk(t *testing.T) {
testshared.NewRunnerBuilder(t).
WithNoConfig().
WithArgs("--enable-all").
Copy link
Contributor

@Antonboom Antonboom Jan 7, 2024

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?

Copy link
Author

@maranqz maranqz Jan 7, 2024

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 error Use factory for unsafe.Pointer.
Or is solution from comment is better?
#4196 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be reverted.

WithArgs(
"--enable-all",
"-D",
"gofactory",
).
WithTargetPath(testdataDir, "unsafe").
Runner().
Install().
Expand Down

AltStyle によって変換されたページ (->オリジナル) /