gitee.com/wgliang/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/golint/testdata/else-multi.go (about)

     1  // Test of return+else warning; should not trigger on multi-branch if/else.
     2  // OK
     3  
     4  // Package pkg ...
     5  package pkg
     6  
     7  import "log"
     8  
     9  func f(x int) bool {
    10  	if x == 0 {
    11  		log.Print("x is zero")
    12  	} else if x > 0 {
    13  		return true
    14  	} else {
    15  		log.Printf("non-positive x: %d", x)
    16  	}
    17  	return false
    18  }