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

cmd/vet: warn about string(int) type conversions #32479

Open
ianlancetaylor opened this issue Jun 7, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@ianlancetaylor
Copy link
Contributor

commented Jun 7, 2019

#3939 proposes removing the explicit type conversion string(i) where i has an integer type other than rune. That is a backward incompatible change, so we cannot make it until we can count on having modules everywhere, with the support modules provide for determining the version of the language to use to compile code.

There is a step we can take today, which is to change go vet to report conversions of integer types other than rune to string. If we think that removing this feature from the language is a good idea, then a vet check for it is a good idea, and it is one that we can implement today.

@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Jun 7, 2019

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 8, 2019

@networkimprov

This comment has been minimized.

Copy link

commented Jun 8, 2019

Pls also permit string(b) where b is a byte or uint8.

@mvdan

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

This seems fine to me. The warning should probably point the user in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.