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

Certificate error handling still incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 0.9.1
    • 0.9.1
    • Go - Library
    • None
    • Patch Available

    Description

      The error handling at LoadX509KeyPair() is still incorrect, it may now throw a Panic instead of reporting the error.

      Main reason is a slight scoping issue. If I read http://golang.org/doc/effective_go.html#redeclaration correctly, then

      var err error
      if foo, err := loadFoo(); err == nil {
          doSomething()
      }
      if err != nil {
        return err
      }
      

      is not the same as

      var err error
      foo, err := loadFoo()
      if err == nil {
          doSomething()
      }
      if err != nil {
        return err
      }
      

      because in the latter case a reassignment happens, while in the former case another, second err variable is declared. Therefore, in the first case the error check after the if may incorrectly report successful execution.

      Attachments

        Issue Links

          Activity

            People

              jensg Jens Geyer
              jensg Jens Geyer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: