code: func (c *TagCache) AddTag(ctx context.Context, pin common.Pin, tag string) error {
  	if err := common.ValidatePin(pin, common.AnyHash); err != nil {
  		return err
  	}
  	if err := common.ValidateInstanceTag(tag); err != nil {
  		return err
  	}
  
  	c.lock.Lock()
  	defer c.lock.Unlock()
  
  	if c.addedTags == nil {
  		c.addedTags = make(map[tagKey]*messages.TagCache_Entry, 1)
  	}
  
  	// 'Save' will merge this into 'c.cache' before dumping to disk.
  	c.addedTags[makeTagKey(pin.PackageName, tag)] = &messages.TagCache_Entry{
  		Service:    c.service,
  		Package:    pin.PackageName,
  		Tag:        tag,
  		InstanceId: pin.InstanceID,
  	}
  
  	return nil
  }
docs: // AddTag records that (pin.PackageName, tag) maps to pin.InstanceID.
  //
  // Call 'Save' later to persist these changes to the cache file on disk.