Naming convention

已回答

Hi 

Is it possible configure naming convention for constant, variable, function and so on ?

ie. constant should be uppercase letters 

Thanks 

0

Hi,

You can configure code style options in the settings: Preferences/Settings | Editor | Code Style | Go. However, there is no setting for naming conventions.

By the way, speaking about upper-case letters for constants, you can take a look at Go Code Review Comments as a good resource for your code styling in Go, as well as naming conventions. According to https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps:

See https://golang.org/doc/effective_go.html#mixed-caps. This applies even when it breaks conventions in other languages. For example an unexported constant is maxLength not MaxLength or MAX_LENGTH.

It would be great if you can share your thoughts on why it is useful to have naming conventions in the case of Go and what options should be included.

0

请先登录再写评论。