Skip to content

Instantly share code, notes, and snippets.

@donchev7
Created September 4, 2022 14:47
Show Gist options
  • Save donchev7/286d33671f45aa75704006289f84fe39 to your computer and use it in GitHub Desktop.
Save donchev7/286d33671f45aa75704006289f84fe39 to your computer and use it in GitHub Desktop.
APIs with multiple parameters of the same type are hard to use correctly.
type Source string
func (src Source) CopyTo(dest string) error {
return CopyFile(dest, string(src))
}
func main() {
var from Source = "presentation.md"
from.CopyTo("/tmp/backup")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment