You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Paul Magrath (JIRA)" <ji...@apache.org> on 2015/03/06 15:25:38 UTC
[jira] [Updated] (THRIFT-3027) Go compiler does not ensure common
initialisms have consistent case
[ https://issues.apache.org/jira/browse/THRIFT-3027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Magrath updated THRIFT-3027:
---------------------------------
Description:
In Go, as per https://github.com/golang/go/wiki/CodeReviewComments#initialisms, words in names that are initialisms or acronyms should have a consistent case.
For example, if you have a struct like:
{code}
struct InitialismsTest {
1: string user_id,
2: string server_url,
}
{/code}
One would expect it to compile to:
{code}
type InitialismsTest struct {
UserID string `thrift:"user_id,1" json:"user_id"`
ServerURL string `thrift:"server_url,2" json:"server_url"`
}
{/code}
Rather than:-
{code}
type InitialismsTest struct {
UserId string `thrift:"user_id,1" json:"user_id"`
ServerUrl string `thrift:"server_url,2" json:"server_url"`
}
{/code}
It would be pretty difficult to handle all cases of initialisms in the Go compiler of course, but there is a set of common initialisms that have been identified by the authors of Golint and could be handled relatively easily:- https://github.com/golang/lint/blob/master/lint.go#L692
was:
In Go, as per https://github.com/golang/go/wiki/CodeReviewComments#initialisms, words in names that are initialisms or acronyms should have a consistent case.
For example, if you have a struct like:
[code]
struct InitialismsTest {
1: string user_id,
2: string server_url,
}
[/code]
One would expect it to compile to:
[code]
type InitialismsTest struct {
UserID string `thrift:"user_id,1" json:"user_id"`
ServerURL string `thrift:"server_url,2" json:"server_url"`
}
[/code]
Rather than:-
[code]
type InitialismsTest struct {
UserId string `thrift:"user_id,1" json:"user_id"`
ServerUrl string `thrift:"server_url,2" json:"server_url"`
}
[/code]
It would be pretty difficult to handle all cases of initialisms in the Go compiler of course, but there is a set of common initialisms that have been identified by the authors of Golint and could be handled relatively easily:- https://github.com/golang/lint/blob/master/lint.go#L692
> Go compiler does not ensure common initialisms have consistent case
> -------------------------------------------------------------------
>
> Key: THRIFT-3027
> URL: https://issues.apache.org/jira/browse/THRIFT-3027
> Project: Thrift
> Issue Type: Improvement
> Components: Go - Compiler
> Affects Versions: 0.9.2
> Reporter: Paul Magrath
> Priority: Minor
>
> In Go, as per https://github.com/golang/go/wiki/CodeReviewComments#initialisms, words in names that are initialisms or acronyms should have a consistent case.
> For example, if you have a struct like:
> {code}
> struct InitialismsTest {
> 1: string user_id,
> 2: string server_url,
> }
> {/code}
> One would expect it to compile to:
> {code}
> type InitialismsTest struct {
> UserID string `thrift:"user_id,1" json:"user_id"`
> ServerURL string `thrift:"server_url,2" json:"server_url"`
> }
> {/code}
> Rather than:-
> {code}
> type InitialismsTest struct {
> UserId string `thrift:"user_id,1" json:"user_id"`
> ServerUrl string `thrift:"server_url,2" json:"server_url"`
> }
> {/code}
> It would be pretty difficult to handle all cases of initialisms in the Go compiler of course, but there is a set of common initialisms that have been identified by the authors of Golint and could be handled relatively easily:- https://github.com/golang/lint/blob/master/lint.go#L692
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)