code: func (m *Manager) Build() error {
  	c, err := m.loadChartDir()
  	if err != nil {
  		return err
  	}
  
  	// If a lock file is found, run a build from that. Otherwise, just do
  	// an update.
  	lock, err := chartutil.LoadRequirementsLock(c)
  	if err != nil {
  		return m.Update()
  	}
  
  	// A lock must accompany a requirements.yaml file.
  	req, err := chartutil.LoadRequirements(c)
  	if err != nil {
  		return fmt.Errorf("requirements.yaml cannot be opened: %s", err)
  	}
  	if sum, err := resolver.HashReq(req); err != nil || sum != lock.Digest {
  		return fmt.Errorf("requirements.lock is out of sync with requirements.yaml")
  	}
  
  	// Check that all of the repos we're dependent on actually exist.
  	if err := m.hasAllRepos(lock.Dependencies); err != nil {
  		return err
  	}
  
  	if !m.SkipUpdate {
  		// For each repo in the file, update the cached copy of that repo
  		if err := m.UpdateRepositories(); err != nil {
  			return err
  		}
  	}
  
  	// Now we need to fetch every package here into charts/
  	return m.downloadAll(lock.Dependencies)
  }
docs: // Build rebuilds a local charts directory from a lockfile.
  //
  // If the lockfile is not present, this will run a Manager.Update()
  //
  // If SkipUpdate is set, this will not update the repository.