code: func (p *PackageDef) Expand(expander template.Expander) (pkg string, err error) {
  	switch pkg, err = expander.Expand(p.PackageTemplate); {
  	case err == template.ErrSkipTemplate:
  		return "", err
  	case err != nil:
  		return "", errors.Annotate(err, "failed to expand package template (line %d)", p.LineNo).Err()
  	}
  	if err = common.ValidatePackageName(pkg); err != nil {
  		return "", errors.Annotate(err, "bad package name (line %d)", p.LineNo).Err()
  	}
  	if err = common.ValidateInstanceVersion(p.UnresolvedVersion); err != nil {
  		return "", errors.Annotate(err, "bad package version (line %d)", p.LineNo).Err()
  	}
  	return
  }
docs: // Expand expands the package name template and checks that resulting package
  // name and version are syntactically correct.
  //
  // May return template.ErrSkipTemplate is this package definition should be
  // skipped given the current expansion variables values.