Skip to content

Instantly share code, notes, and snippets.

@Diggsey
Created June 1, 2018 16:39
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 Diggsey/46e5641f810f57adc5de6b99858f52a3 to your computer and use it in GitHub Desktop.
Save Diggsey/46e5641f810f57adc5de6b99858f52a3 to your computer and use it in GitHub Desktop.
type Patch struct {
// Implementation detail, should not be accessed
from string
to string
}
func NewPatch(from string, to string) *Patch {
return &Patch { from, to }
}
func (patch *Patch) Apply(from string) string {
if patch.from != from {
panic("Patch applied incorrectly")
}
return patch.to
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment