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

     1  // run
     2  
     3  // Copyright 2016 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  import "time"
    10  
    11  type T struct{}
    12  
    13  func (*T) Foo(vals []interface{}) {
    14  	switch v := vals[0].(type) {
    15  	case string:
    16  		_ = v
    17  	}
    18  }
    19  
    20  type R struct{ *T }
    21  
    22  type Q interface {
    23  	Foo([]interface{})
    24  }
    25  
    26  func main() {
    27  	var q Q = &R{&T{}}
    28  	for i := 0; i < 10000; i++ {
    29  		go func() {
    30  			defer q.Foo([]interface{}{"meow"})
    31  			time.Sleep(100 * time.Millisecond)
    32  		}()
    33  	}
    34  	time.Sleep(1 * time.Second)
    35  }