code: func NewModuleTree(mods map[string]*Module) *ModuleTreeNode {
  	root := &ModuleTreeNode{
  		Children: map[Value]*ModuleTreeNode{},
  	}
  	for _, m := range mods {
  		node := root
  		for i, x := range m.Package.Path {
  			c, ok := node.Children[x.Value]
  			if !ok {
  				var hide bool
  				if i == 1 && x.Value.Compare(SystemDocumentKey) == 0 {
  					hide = true
  				}
  				c = &ModuleTreeNode{
  					Key:      x.Value,
  					Children: map[Value]*ModuleTreeNode{},
  					Hide:     hide,
  				}
  				node.Children[x.Value] = c
  			}
  			node = c
  		}
  		node.Modules = append(node.Modules, m)
  	}
  	return root
  }
docs: // NewModuleTree returns a new ModuleTreeNode that represents the root
  // of the module tree populated with the given modules.