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

Go compiler does not ensure common initialisms have consistent case

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.9.2
    • 0.9.3
    • Go - Compiler
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: