Skip to content
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

enable additional linters #589

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Dec 22, 2024

This pull request adds additional linters and works towards a more ideal configuration for the linter.

This is the most completely linted version. Before reviewing this, I do recommend that you review The pull requests that are in the style requested by @webmaster128

He asked for multiple PRS, each enabling more linters. This is the last of them.

@faddat faddat marked this pull request as draft December 22, 2024 19:26
@faddat faddat mentioned this pull request Dec 23, 2024
@faddat faddat marked this pull request as ready for review January 2, 2025 18:52
@faddat
Copy link
Contributor Author

faddat commented Jan 2, 2025

@webmaster128 please check this out, as well as the other, related pull requests.

@faddat faddat mentioned this pull request Jan 12, 2025
Copy link
Collaborator

@chipshort chipshort left a comment

Choose a reason for hiding this comment

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

Not a full review.
I am interested in the linters (and the fixes that make them happy), but there are lots of unrelated changes in here that need to be discussed. I would appreciate if we keep these in separate PRs, so they don't block the us from merging the linters.

Comment on lines -334 to +337
if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success {
if err != nil && err.(syscall.Errno) != 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change? I like the constant here because it makes it clear immediately that this is the unsuccessful case.

@@ -1,6 +1,6 @@
module github.com/CosmWasm/wasmvm/v2

go 1.21
go 1.23
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this required for the linters?

Comment on lines +843 to +845
testMutex.Lock()
info = MockInfoBin(b, "fred")
testMutex.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir, to understand why, please simply take the configuration file for the linter, put it in the main Branch, and you'll see why

Copy link
Collaborator

Choose a reason for hiding this comment

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

I ran golangci-lint run with the .golangci.yml from this branch and see no output related to this. I also ran it directly on this branch after removing the lock and it's happy without it.
It makes zero sense to lock this mock function call.

// There is no allocation we can copy
out = []byte{}
} else {
// C.GoBytes create a copy (https://stackoverflow.com/a/40950744/2013738)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This removes an important comment

@@ -92,7 +94,7 @@ func copyU8Slice(view C.U8SliceView) []byte {
// In this case, we don't want to look into the ptr
return []byte{}
}
// C.GoBytes create a copy (https://stackoverflow.com/a/40950744/2013738)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants