Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3027

Go compiler does not ensure common initialisms have consistent case

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.9.3
    • Component/s: Go - Compiler
    • Labels:
      None
    • Patch Info:
      Patch Available

      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:

      struct InitialismsTest {
          1: string user_id,
          2: string server_url,
      }
      

      One would expect it to compile to:

      type InitialismsTest struct {
      	UserID    string `thrift:"user_id,1" json:"user_id"`
      	ServerURL string `thrift:"server_url,2" json:"server_url"`
      }
      

      Rather than:-

      type InitialismsTest struct {
      	UserId    string `thrift:"user_id,1" json:"user_id"`
      	ServerUrl string `thrift:"server_url,2" json:"server_url"`
      }
      

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jensg Jens Geyer
                Reporter:
                magrath Paul Magrath
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: