func diff(a, b []string) []string {
	d := make([]string, 0)
	for _, va := range a {
		found := false
		for _, vb := range b {
			if va == vb {
				found = true
				break
			}
		}
		if !found {
			d = append(d, va)
		}
	}
	return d
}
diff(a, b) = a - a(n)b
package lib
import (
	"google.golang.org/grpc/naming"
)
func GenUpdates(a, b []string) []*naming.Update {
	updates := []*naming.Update{}
	deleted := diff(a, b)
	for _, addr := range deleted {
		update := &naming.Update{Op: naming.Delete, Addr: addr}
		updates = append(updates, update)
	}
	added := diff(b, a)
	for _, addr := range added {
		update := &naming.Update{Op: naming.Add, Addr: addr}
		updates = append(updates, update)
	}
	return updates
}