modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue19467.dir/z.go (about)

     1  // Copyright 2017 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  	"./mysync"
     9  	"log"
    10  	"runtime"
    11  )
    12  
    13  func main() {
    14  	var wg mysync.WaitGroup
    15  	wg.Done()
    16  	ci := runtime.CallersFrames(wg.Callers)
    17  	frames := make([]runtime.Frame, 0, 4)
    18  	for {
    19  		frame, more := ci.Next()
    20  		frames = append(frames, frame)
    21  		if !more {
    22  			break
    23  		}
    24  	}
    25  	expecting := []string{
    26  		"mysync.(*WaitGroup).Add",
    27  		"mysync.(*WaitGroup).Done",
    28  	}
    29  	for i := 0; i < 2; i++ {
    30  		if frames[i].Function != expecting[i] {
    31  			log.Fatalf("frame %d: got %s, want %s", i, frames[i].Function, expecting[i])
    32  		}
    33  	}
    34  }