code: func (c *TagCache) ResolveTag(ctx context.Context, pkg, tag string) (pin common.Pin, err error) {
  	if err = common.ValidatePackageName(pkg); err != nil {
  		return
  	}
  	if err = common.ValidateInstanceTag(tag); err != nil {
  		return
  	}
  
  	c.lock.Lock()
  	defer c.lock.Unlock()
  
  	// Already added with AddTag recently?
  	if e := c.addedTags[makeTagKey(pkg, tag)]; e != nil {
  		return common.Pin{
  			PackageName: e.Package,
  			InstanceID:  e.InstanceId,
  		}, nil
  	}
  
  	if err = c.lazyLoadLocked(ctx); err != nil {
  		return
  	}
  
  	// Most recently used tags are usually at the end, search in reverse as a
  	// silly optimization.
  	for i := len(c.cache.Entries) - 1; i >= 0; i-- {
  		e := c.cache.Entries[i]
  		if e.Package == pkg && e.Tag == tag {
  			return common.Pin{
  				PackageName: pkg,
  				InstanceID:  e.InstanceId,
  			}, nil
  		}
  	}
  
  	return
  }
docs: // ResolveTag returns cached tag or empty Pin{} if such tag is not in the cache.
  //
  // Returns error if the cache can't be read.