Skip to content

Instantly share code, notes, and snippets.

@maxtaco
Created July 8, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtaco/a55b6aeec698a374335879e433aa0fca to your computer and use it in GitHub Desktop.
Save maxtaco/a55b6aeec698a374335879e433aa0fca to your computer and use it in GitHub Desktop.
type Wrapper struct {
fd int
}
func open(s string) *Wrapper {
return &Wrapper{ openPipe(s); }
}
func (w *Wrapper) Close() {
Close(w.fd)
}
a := open("foo")
a.Close()
b := open("foo")
a.Close()
b.Write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment