diff.go
func Diff(old, new io.Reader, patch io.Writer) error {
	obuf, err := ioutil.ReadAll(old)
	if err != nil {
		return err
	}

	nbuf, err := ioutil.ReadAll(new)
	if err != nil {
		return err
	}

	pbuf, err := diffBytes(obuf, nbuf)
	if err != nil {
		return err
	}

	_, err = patch.Write(pbuf)
	return err
}
func Diff(old, new io.Reader, patch io.Writer) error {
	obuf, err := ioutil.ReadAll(old)
	if err != nil {
		return err
	}

	nbuf, err := ioutil.ReadAll(new)
	if err != nil {
		return err
	}

	pbuf, err := diffBytes(obuf, nbuf)
	if err != nil {
		return err
	}

	_, err = patch.Write(pbuf)
	return err
}
func Diff ( old , new io . Reader , patch io . Writer ) error { obuf , err := ioutil . ReadAll ( old ) if err != nil { return err } nbuf , err := ioutil . ReadAll ( new ) if err != nil { return err } pbuf , err := diffBytes ( obuf , nbuf ) if err != nil { return err } _ , err = patch . Write ( pbuf ) return err }
// Diff computes the difference between old and new, according to the bsdiff
// algorithm, and writes the result to patch.
Diff computes the difference between old and new according to the bsdiff algorithm and writes the result to patch .