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

Naming Style for Go: same name in package is not allowed #6

Open
huan opened this issue Apr 3, 2020 · 1 comment
Open

Naming Style for Go: same name in package is not allowed #6

huan opened this issue Apr 3, 2020 · 1 comment
Labels
question Further information is requested

Comments

@huan
Copy link
Member

huan commented Apr 3, 2020

Questions from WIP: add user/message.go #4

Q1

Q1: Go does not allow const of the same name and different types in the same package; so I changed the name of the constant, which may differ from the community specification, I wonder if it is appropriate?

I understand the naming style is different between the language specifications.

From TypeScript to Go means, we have to change some of our naming specifications so that the code can fit the Go styles.

My opinion is: we should follow the style from TS Wechaty as our default, and only change it when there's a must.

For the Go Lang, I believe we can follow another official style which will be a perfect match: @chatie/grpc (Wechaty has dependency to this module)

You can find the Image definition here:

https://github.com/Chatie/grpc/blob/ab85b7345b90c167a031710b9a819f9220c09002/proto/wechaty/puppet/message.proto#L25-L30

enum ImageType {
  IMAGE_TYPE_UNSPECIFIED = 0;
  IMAGE_TYPE_THUMBNAIL   = 1;
  IMAGE_TYPE_HD          = 2;
  IMAGE_TYPE_ARTWORK     = 3;
}

Which means in Go, we can align to:

  ImageTypeUnspecified ImageType = 0
  ImageTypeThumbnail = 1
  ImageTypeHd = 2
  ImageTypeArtwork = 3
@huan huan added the question Further information is requested label Apr 3, 2020
@huan
Copy link
Member Author

huan commented Apr 3, 2020

I believe #9 has plenty of examples related to this discussion.

@dingdayu Could you please have a look at that PR and make some comments?

And also I'd like to invite you to make a code review for that PR, make a Request changes or Approve it so that we can get an alignment together with @SilkageNet

image

Thank you very much!

@huan huan mentioned this issue Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant