Another way of framing this would be to have a method that returns a WriteCloser
func (Client) NewWriter(ctx context.Context, name upspin.PathName) io.WriteCloser
of course, that doesn't give you the resulting DirEntry in that case. I wonder how often that is used? Curious.
To get around that you could have it return a Writer type that looks something like:
type Writer struct {
io.WriteCloser
}
// DirEntry returns the DirEntry for the written file.
// It should only be called after the Close method returns a nil error.
func (Writer) DirEntry() *upspin.DirEntry
I wonder if that's more or less convenient than your Write method (I'd probably name yours PutReader or PutFromReader, something that gives a clue that it's a Put that's happening ultimately).
I have some dim memory of having written something like this before, but I can't find it now. :-/
Andrew