func (h *Handler) SetPackages(src PackageFinder, pkgs []Package) {
	h.mu.Lock()
	defer h.mu.Unlock()
	prevPkgs, ok := h.srcs[src]
	if ok {
		for _, p := range prevPkgs {
			delete(h.paths, p.Path)
		}
	}
	for i := range pkgs {
		p := &pkgs[i]
		if validVCS(p.VCS) {
			s := path.Clean(p.Path)
			p.Path = s
			h.paths[s] = *p
		} else {
			panic(fmt.Errorf("goimport: unknown vcs %s", p.VCS))
		}
	}
	h.srcs[src] = pkgs
}
SetPackages is called by PackageFinders for updating our set of
packages.
package goimport
import (
	"fmt"
	"net/http"
	"path"
	"sync"
)
type Handler struct {
	mu    sync.RWMutex
	root  http.Handler
	paths map[string]Package
	srcs  map[PackageFinder]Packages
}
func Handle(root http.Handler, sources ...PackageFinder) *Handler {
	if root == nil {
		root = http.NotFoundHandler()
	}
	h := &Handler{
		root:  root,
		paths: make(map[string]Package),
		srcs:  make(map[PackageFinder]Packages),
	}
	for _, src := range sources {
		go src.FindPackages(h)
	}
	return h
}
func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	if !h.tryServe(w, req) {
		h.root.ServeHTTP(w, req)
	}
}
func validVCS(vcs string) bool {
	switch vcs {
	case "git", "hg", "bzr", "svn":
		return true
	default:
		return false
	}
}