code: func (m TaskManager) ValidateProtoMessage(c *validation.Context, msg proto.Message) {
  	cfg, ok := msg.(*messages.GitilesTask)
  	if !ok {
  		c.Errorf("wrong type %T, expecting *messages.GitilesTask", msg)
  		return
  	}
  
  	// Validate 'repo' field.
  	c.Enter("repo")
  	if cfg.Repo == "" {
  		c.Errorf("field 'repository' is required")
  	} else {
  		u, err := url.Parse(cfg.Repo)
  		if err != nil {
  			c.Errorf("invalid URL %q: %s", cfg.Repo, err)
  		} else if !u.IsAbs() {
  			c.Errorf("not an absolute url: %q", cfg.Repo)
  		}
  	}
  	c.Exit()
  
  	c.Enter("refs")
  	gitiles.ValidateRefSet(c, cfg.Refs)
  	c.Exit()
  
  	validatePathRegexp := func(p string) {
  		if p == "" {
  			c.Errorf("must not be empty")
  		}
  		if strings.HasPrefix(p, "^") || strings.HasSuffix(p, "$") {
  			c.Errorf("^ and $ qualifiers are added automatically, please remove them")
  		}
  		_, err := regexp.Compile(p)
  		if err != nil {
  			c.Errorf("%s", err)
  		}
  	}
  
  	for _, p := range cfg.PathRegexps {
  		c.Enter("path_regexps %q", p)
  		validatePathRegexp(p)
  		c.Exit()
  	}
  	if len(cfg.PathRegexpsExclude) > 0 && len(cfg.PathRegexps) == 0 {
  		c.Errorf("Specifying path_regexps_exclude not allowed without at least one path_regexps")
  	} else {
  		for _, p := range cfg.PathRegexpsExclude {
  			c.Enter("path_regexps_exclude %q", p)
  			validatePathRegexp(p)
  			c.Exit()
  		}
  	}
  }
docs: // ValidateProtoMessage is part of Manager interface.