Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-504

Support multiple return values in Go

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8
    • Component/s: Go
    • Labels:

      Description

      Currently a NativeTree is created instead of ReturnTree for this line of code:

      return false, nil
      

      It causes:

      • FN for S1763
        func statement_after_multi_values_return() (int, string) {
            return 42, "42" // False negative
            fmt.Print("Will not execute")
        }
        
      • FP for S126
        if cond1 {
        	return "a"
        } else if cond2 { // FP
        	return "a", "b"
        }
        

        Attachments

          Activity

            People

            Assignee:
            quentin.jaquier Quentin Jaquier
            Reporter:
            amelie.renard Amélie Renard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: