github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/unused/testdata/src/switch_interface/switch_interface.go (about)

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