// extractTag gets the comment-tags for the key.  If the tag did not exist, it
// returns the empty string.
770525
func extractTag(key string, lines []string) string {
	val, present := types.ExtractCommentTags("+", lines)[key]
	if !present || len(val) < 1 {
		return ""
	}

	return val[0]
}
411588
func Tag(key string, value interface{}) Option {
	return func(c *Options) {
		c.tags = append(c.tags, opentracing.Tag{Key: key, Value: value})
	}
}
1078298
func unexpectedTag(tag byte, expectTags []byte) {
	if tag == 0 {
		panic(errors.New("No byte found in stream"))
	} else if expectTags == nil {
		panic(errors.New("Unexpected serialize tag '" + string(rune(tag)) + "' in stream"))
	} else {
		panic(errors.New("Tag '" + string(expectTags) + "' expected, but '" + string(rune(tag)) + "' found in stream"))
	}
}
87160
func getTypeTag(arg interface{}) (string, error) {
	switch t := arg.(type) {
	case bool:
		if arg.(bool) {
			return "T", nil
		}
		return "F", nil
	case nil:
		return "N", nil
	case int32:
		return "i", nil
	case float32:
		return "f", nil
	case string:
		return "s", nil
	case []byte:
		return "b", nil
	case int64:
		return "h", nil
	case float64:
		return "d", nil
	case Timetag:
		return "t", nil
	default:
		return "", fmt.Errorf("Unsupported type: %T", t)
	}
}
605477
func (p *propTags) RemoveTag(target string) {
	if !p.HasTag(target) {
		return
	}
	res := []string{}
	for _, tag := range p.Tags {
		if tag != target {
			res = append(res, tag)
		}
	}

	p.Tags = res
}
16177
func (c *GitHubClient) DeleteTag(ctx context.Context, tag string) error {
	ref := fmt.Sprintf("tags/%s", tag)
	res, err := c.Git.DeleteRef(context.TODO(), c.Owner, c.Repo, ref)
	if err != nil {
		return errors.Wrapf(err, "failed to delete tag: %s", ref)
	}

	if res.StatusCode != http.StatusNoContent {
		return errors.Errorf("delete tag: invalid status: %s", res.Status)
	}

	return nil
}
820447
func ValidateTag(tag string) ([]string, error) {
	ltag := strings.ToLower(tag)
	if !validTagRe.MatchString(ltag) {
		return nil, fmt.Errorf("invalid tag: %q", tag)
	}
	ltags := strings.Split(ltag, ":")
	return ltags, nil
}
642870
func (f *FieldSetType) AddTag(tag string) *FieldSetType {
	f.tags[tag] = struct{}{}
	return f
}
1326622
func ExtractPrefix(doc io.Reader, prefix string) ([]MetaData, error) {
	var tags []MetaData
	z := html.NewTokenizer(doc)
	for {
		tt := z.Next()
		if tt == html.ErrorToken {
			if z.Err() == io.EOF {
				return tags, nil
			}
			return nil, z.Err()
		}

		t := z.Token()

		if t.DataAtom == atom.Head && t.Type == html.EndTagToken {
			return tags, nil
		}

		if t.DataAtom == atom.Meta {
			var prop, cont, name, tagPrefix string
			for _, a := range t.Attr {
				switch a.Key {
				case "property":
					prop = a.Val
				case "name":
					name = a.Val
				case "content":
					cont = a.Val
				}
			}

			if prop == "" {
				prop = name
			}

			if prop == "" || cont == "" {
				continue
			}

			if prefix != "" {
				if !strings.HasPrefix(prop, prefix+":") {
					continue
				}
				tagPrefix = prefix
			} else {
				idx := strings.Index(prop, ":")
				if idx == -1 {
					continue
				}
				tagPrefix = prop[:idx]
			}

			tags = append(tags, MetaData{prop[len(tagPrefix+":"):], cont, tagPrefix})
		}
	}

	return tags, nil
}
1044172
func (f *Field) RemoveTag(tag string) FieldInterface {
	delete(f.tag, tag)
	return f
}
653337
func (repo *Repository) DeleteTag(name string) error {
	cmd := NewCommand("tag", "-d")

	cmd.AddArguments(name)
	_, err := cmd.RunInDir(repo.Path)

	return err
}
1352190
func extractWhitespaceTag(message ValidMessage) (plain MessagePlaintext, versions int) {
	wsPos := bytes.Index(message, whitespaceTagHeader)
	currentData := message[wsPos+len(whitespaceTagHeader):]

	for {
		aw, r, has := nextAllWhite(currentData)
		if !has {
			break
		}
		currentData = r
		if bytes.Equal(aw, otrV3{}.whitespaceTag()) {
			versions |= (1 << 3)
		} else if bytes.Equal(aw, otrV2{}.whitespaceTag()) {
			versions |= (1 << 2)
		}
	}

	plain = makeCopy(append(message[:wsPos], currentData...))
	return
}
1096196
func (pb *pointBuilder) extractTags(mbean string) map[string]string {
	propertyMap := makePropertyMap(mbean)
	tagMap := make(map[string]string)

	for key, value := range propertyMap {
		if pb.includeTag(key) {
			tagName := pb.formatTagName(key)
			tagMap[tagName] = value
		}
	}

	return tagMap
}
400599
func (repo *Repository) GetTag(name string) (*Tag, error) {
	stdout, err := NewCommand("show-ref", "--tags", name).RunInDir(repo.Path)
	if err != nil {
		return nil, err
	}

	id, err := NewIDFromString(strings.Split(stdout, " ")[0])
	if err != nil {
		return nil, err
	}

	tag, err := repo.getTag(id)
	if err != nil {
		return nil, err
	}
	tag.Name = name
	return tag, nil
}
1129451
func (s *handler) DetachTag(id vim.ManagedObjectReference, tag vim.VslmTagEntry) vim.BaseMethodFault {
	t := s.findTag(tag)
	if t == nil {
		return new(vim.NotFound)
	}
	delete(s.Association[t.ID], internal.AssociatedObject(id))
	return nil
}
1174641
func TagsExtractMeta(tags map[string]interface{}) (InstanceCNS, map[string]interface{}) {
	nativeCNS := InstanceCNS{}
	nativeTags := make(map[string]interface{}, len(tags))
	for k, raw := range tags {
		if _, found := reservedInstanceCNSTags[k]; found {
			switch k {
			case CNSTagDisable:
				b := raw.(bool)
				nativeCNS.Disable = b
			case CNSTagReversePTR:
				s := raw.(string)
				nativeCNS.ReversePTR = s
			case CNSTagServices:
				nativeCNS.Services = strings.Split(raw.(string), ",")
			default:
				// TODO(seanc@): should assert, logic fail
			}
		} else {
			nativeTags[k] = raw
		}
	}

	return nativeCNS, nativeTags
}
313938
func (r *RepositoryRelease) GetTagName() string {
	if r == nil || r.TagName == nil {
		return ""
	}
	return *r.TagName
}