github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/testutils/testdata/helloworld.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"math/rand"
     6  )
     7  
     8  //go:noinline
     9  func noParameter() {
    10  	fmt.Println("Hello world")
    11  }
    12  
    13  //go:noinline
    14  func oneParameter(s []int) []int {
    15  	s2 := []int{2}
    16  	return append(s, s2...)
    17  }
    18  
    19  //go:noinline
    20  func oneParameterAndOneVariable(i int) {
    21  	a := rand.Int()
    22  	fmt.Println(i, a)
    23  	fmt.Println(i, a)
    24  }
    25  
    26  //go:noinline
    27  func twoParameters(j, i int) { // intentionally inverse
    28  	a := rand.Int()
    29  	fmt.Println(j, a)
    30  	fmt.Println(i, a)
    31  }
    32  
    33  //go:noinline
    34  func twoReturns() (int, int) {
    35  	return rand.Int(), rand.Int()
    36  }
    37  
    38  func main() {
    39  	noParameter()
    40  	oneParameter([]int{1})
    41  	oneParameterAndOneVariable(1)
    42  	twoParameters(1, 1)
    43  	_, _ = twoReturns()
    44  }