github.com/songshiyun/revive@v1.1.5-0.20220323112655-f8433a19b3c5/testdata/deep-exit.go (about)

     1  package fixtures
     2  
     3  import (
     4  	"log"
     5  	"os"
     6  	"syscall"
     7  	"testing"
     8  )
     9  
    10  func foo0() {
    11  	os.Exit(1) // MATCH /calls to os.Exit only in main() or init() functions/
    12  }
    13  
    14  func init() {
    15  	log.Fatal("v ...interface{}")
    16  }
    17  
    18  func foo() {
    19  	log.Fatalf(1) // MATCH /calls to log.Fatalf only in main() or init() functions/
    20  }
    21  
    22  func main() {
    23  	log.Fatalln("v ...interface{}")
    24  }
    25  
    26  func bar() {
    27  	log.Fatal(1) // MATCH /calls to log.Fatal only in main() or init() functions/
    28  }
    29  
    30  func bar2() {
    31  	bar()
    32  	syscall.Exit(1) // MATCH /calls to syscall.Exit only in main() or init() functions/
    33  }
    34  
    35  func TestMain(m *testing.M) {
    36  	// must match because this is not a test file
    37  	os.Exit(m.Run()) // MATCH /calls to os.Exit only in main() or init() functions/
    38  }