You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: endpoint.go
    path of file: ./repos/lastbackend/pkg/discovery/runtime/endpoint
    
    the code of the file until where you have to start completion: //
// Last.Backend LLC CONFIDENTIAL
// __________________
//
// [2014] - [2019] Last.Backend LLC
// All Rights Reserved.
//
// NOTICE:  All information contained herein is, and remains
// the property of Last.Backend LLC and its suppliers,
// if any.  The intellectual and techni
    
func Watch(ctx context.Context) {

	log.V(logLevel).Debugf("%s:restore:> watch change endpoint start", logPrefix)

	var (
		em    = distribution.NewEndpointModel(ctx, envs.Get().GetStorage())
		cache = envs.Get().GetCache().Endpoint()
		event = make(chan types.EndpointEvent)
	)

	go func() {
		for {
			select {
			case e := <-event:
				{

					if e.Data == nil {
						continue
					}

					endpoint := e.Data

					switch e.Action {
					case types.EventActionCreate:
						fallthrough
					case types.EventActionUpdate:
						cache.Del(endpoint.Spec.Domain)
						envs.Get().GetCache().Endpoint().Set(endpoint.Spec.Domain, []string{endpoint.Spec.IP})
						continue
					case types.EventActionDelete:
						cache.Del(endpoint.Spec.Domain)
						continue
					}

				}
			}
		}
	}()

	go em.Watch(event, nil)
}