github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/unused/testdata/src/example.com/switch_interface/switch_interface.go (about)

     1  package pkg
     2  
     3  type t struct{} //@ used("t", true)
     4  
     5  func (t) fragment() {} //@ used("fragment", true)
     6  
     7  func fn() bool { //@ used("fn", true)
     8  	var v interface{} = t{}  //@ used("v", true)
     9  	switch obj := v.(type) { //@ used("obj", true)
    10  	case interface {
    11  		fragment() //@ used("fragment", true)
    12  	}:
    13  		obj.fragment()
    14  	}
    15  	return false
    16  }
    17  
    18  var x = fn() //@ used("x", true)
    19  var _ = x    //@ used("_", true)