unexported.mx raw

   1  package unexported
   2  
   3  // Sealed declares an unexported method, so a type from another package can
   4  // never implement it: method identity includes the package for an unexported
   5  // name.
   6  type Sealed interface {
   7  	seal() (n int32)
   8  }
   9  
  10  type box struct {
  11  	n int32
  12  }
  13  
  14  func (b *box) seal() (n int32) { return b.n }
  15  
  16  // Make returns a Sealed so a caller has a value to try the call on.
  17  func Make(n int32) (s Sealed) { return &box{n: n} }
  18