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

x/tools/gopls: Reports for redundant type conversion #58568

Open
hushyael opened this issue Feb 10, 2023 · 0 comments
Open

x/tools/gopls: Reports for redundant type conversion #58568

hushyael opened this issue Feb 10, 2023 · 0 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hushyael
Copy link

Problem
Sometimes you can miss redundant type conversion in your code.

var ids []int32
for _, groups := range groupsCollection {
    if len(groups) > 0 {
        ids = append(ids, int32(groups[0])) // groups[0] is already int32  so there is unnecessary conversion
    }
}

Solution
Could you add warnings about unnecessary type conversion as it is done in goland

@jamalc jamalc transferred this issue from golang/vscode-go Feb 16, 2023
@jamalc jamalc changed the title Reports for redundant type conversion x/tools/gopls: Reports for redundant type conversion Feb 16, 2023
@jamalc jamalc added this to the gopls/later milestone Feb 16, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants