如何实现接口,但是发布新的API?

How does one implement an interface but forbid users from calling the functions that implement that interface?

For example, we have a module that implements some interface I which has a required function to implement Bar:

//mymodule.go
import (I)

type Foo struct {
}

func (f *Foo) Bar(
      ...
      // DONT want users calling this directly
      // I.Bar eventually calls this   
) // dictated by I

func (f *Foo) BarCallMe() {
    ...
    I.Bar(f)
}

F = Foo{}
F.Bar() // make this not possible, do not want!
F.BarCallMe() // $PROFIT

How do we prevent a user of mymodule from using Bar() directly like f.Bar()? Meaning, if we want users of this module to only call BarCallMe how do we hide Bar?

More generically, how do you implement one interface but publish another?

Concrete example: Recently I implemented golang's heap interface which requires Push and Pop be implemented by the implementor. However, heap.Push calls your Push (https://golang.org/src/container/heap/heap.go?s=1949:1986#L42), so if a user called my Push directly, it would not have the intended result. So the question here is how to publish a Push that users call, while still providing a Push that meets the interface reqs.

You could use an unexported type, and only implement the method on the "alias":

https://play.golang.org/p/ZHg2U1sbVwo

type Foo struct {}
type foo Foo

func (f *foo) Bar(
  ...
) // dictated by I

func (f Foo) BarCallMe() {
    ...
    I.Bar(foo(f))
}

Very simply you can't. If you don't provide all of the methods in the interface, then you don't implement the interface, and if the interface requires that the methods are exported (which it must, because you're using it from another package), then those methods have to be public. No amount of playing around with anonymous embedding or new type names is going to change the fact that if you want your user to be able to pass something to heap.Pop, it must have a Pop() that they can call. If you create something that doesn't have Pop() callable on it, then it isn't usable with the functions in heap, and won't be unless you provide some way to turn it into a heap.Interface, at which point the user will be able to call Pop() on it. This isn't unique to you, and it's fundamental to how the Go designers chose to make interfaces work. You can live with it (and trust your users not to deliberately break things), or you can choose not to use the containers in the standard library.