github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/error6.ng (about)

     1  func f() (string, error) { return "f", nil}
     2  
     3  count := 0
     4  
     5  func g(x string) {
     6  	count += len(x)
     7  }
     8  
     9  g("g")
    10  g(f())
    11  g(f() + f())
    12  g($$ echo hello $$)
    13  
    14  func both(x string, err error) {
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  	count += len(x)
    19  }
    20  
    21  both(f())
    22  
    23  if count == 11 {
    24  	print("OK")
    25  }