github.com/DQNEO/babygo@v0.0.3/t/another.go (about)

     1  package main
     2  
     3  import "syscall"
     4  import "github.com/DQNEO/babygo/lib/strconv"
     5  
     6  func anotherFunc() string {
     7  	return anotherVar
     8  }
     9  
    10  func nop()  {}
    11  func nop1() {}
    12  func nop2() {}
    13  
    14  // --- utils ---
    15  func write(x interface{}) {
    16  	var s string
    17  	switch xx := x.(type) {
    18  	case int:
    19  		s = strconv.Itoa(xx)
    20  	case string:
    21  		s = xx
    22  	}
    23  	var slc []uint8 = []uint8(s)
    24  	syscall.Write(1, slc)
    25  }
    26  
    27  func writeln(s interface{}) {
    28  	write(s)
    29  	write("\n")
    30  }