Movatterモバイル変換


[0]ホーム

URL:


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

Addgofactory 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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
maranqz wants to merge19 commits intogolangci:master
base:master
Choose a base branch
Loading
frommaranqz:go-factory-lint
Open
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
bbe0eb9
1. Added reference
maranqzNov 12, 2023
70cd3e5
1. Update version after type fixes
maranqzNov 15, 2023
5a86fb8
1. Added tests in subdir
maranqzNov 15, 2023
2a31b53
1. Bump golangci-lint version
maranqzNov 15, 2023
22e29b7
1. Fixed settings name
maranqzNov 15, 2023
faecc6b
1. Fixed test with config file
maranqzNov 15, 2023
2fde9ce
1. Update config after linter fixing
maranqzNov 19, 2023
bb4065b
1. Remove slog to pass go1.20 test
maranqzNov 20, 2023
419bf43
Merge branch 'master' into go-factory-lint
maranqzNov 20, 2023
e40eddf
Merge branch 'master' into go-factory-lint
maranqzNov 26, 2023
930e2b2
1. Added casting function
maranqzNov 26, 2023
c1195cf
1. renamed linter
maranqzDec 15, 2023
ba1ed19
Merge branch 'master' into go-factory-lint
maranqzDec 15, 2023
2b59b9d
1. fixed tests
maranqzDec 15, 2023
eb43dd5
1. moved gofactory test from dedicated to common directory
maranqzDec 17, 2023
df588bc
Merge branch 'master' into go-factory-lint
maranqzDec 17, 2023
a1dbfe1
Merge branch 'master' into go-factory-lint
maranqzDec 18, 2023
985e045
Merge branch 'master' into go-factory-lint
maranqzDec 19, 2023
111f638
Merge branch 'master' into go-factory-lint
maranqzJan 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
PrevPrevious commit
NextNext commit
1. fixed tests
  • Loading branch information
@maranqz
maranqz committedDec 15, 2023
commit2b59b9ddf35e16644927a662ff522a95a8332568
8 changes: 6 additions & 2 deletionstest/run_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 movetest/testdata/gofactory/blocked.go totest/testdata/gofactory/gofactory_package_globs_only.go?

Copy link
Member

@ldezldezDec 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 insidetest/testdata/ and not a dedicated folder.
and your linter should be removed fromtest/linters_test.go.

#4196 (comment)

Copy link
Contributor

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

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 errorUse factory for unsafe.Pointer.

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

Copy link
Contributor

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 ofexclude-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

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

).
WithTargetPath(testdataDir, "cgo").
Runner().
Expand DownExpand 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

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

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)

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

[8]ページ先頭

©2009-2025 Movatter.jp