github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/covdata/testdata/prog1.go (about)

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"os"
     9  	"prog/dep"
    10  )
    11  
    12  //go:noinline
    13  func first() {
    14  	println("whee")
    15  }
    16  
    17  //go:noinline
    18  func second() {
    19  	println("oy")
    20  }
    21  
    22  //go:noinline
    23  func third(x int) int {
    24  	if x != 0 {
    25  		return 42
    26  	}
    27  	println("blarg")
    28  	return 0
    29  }
    30  
    31  //go:noinline
    32  func fourth() int {
    33  	return 99
    34  }
    35  
    36  func main() {
    37  	println(dep.Dep1())
    38  	dep.PDep(2)
    39  	if len(os.Args) > 1 {
    40  		second()
    41  		third(1)
    42  	} else if len(os.Args) > 2 {
    43  		fourth()
    44  	} else {
    45  		first()
    46  		third(0)
    47  	}
    48  }