// ArchTag returns the archtag for images
17110
func ArchTag(hasTag bool) string {
	if runtime.GOARCH == "amd64" && hasTag == false {
		return ":"
	} else {
		return "-" + runtime.GOARCH + ":"
	}
}
575232
func (i *Image) fetchTags() (map[string]string, error) {
	// There is a weird quirk about Docker API: if tags are requested from index.docker.io,
	// it returns a list of short layer IDs, so it's impossible to use them to download actual layers.
	// However, when we hit the endpoint returned by image index API response, it has an expected format.
	var tags map[string]string
	err := i.parseResponse(fmt.Sprintf("v1/repositories/%s/tags", i.Name), &tags)
	if err != nil {
		return nil, err
	}
	return tags, nil
}
406991
func typeTag(structType reflect.Type) byte {
	var tag byte
	var tagStr string
	tagStr = structType.Field(0).Tag.Get("sshtype")
	i, err := strconv.Atoi(tagStr)
	if err == nil {
		tag = byte(i)
	}
	return tag
}
1226305
func (s *LifecyclePolicyPreviewResult) SetImageTags(v []*string) *LifecyclePolicyPreviewResult {
	s.ImageTags = v
	return s
}
536048
func (dfs *DistributedFilesystem) Tag(snapshotID string, tagName string) error {
	// Get the parent volume that owns the snapshot
	vol, err := dfs.disk.GetTenant(snapshotID)
	if err != nil {
		glog.Errorf("Could not get tenant of snapshot %s: %s", snapshotID, err)
		return err
	}
	// Add a tag to the snapshot
	if err := vol.TagSnapshot(snapshotID, tagName); err != nil {
		glog.Errorf("Could not add tag %s to snapshot %s: %s", tagName, snapshotID, err)
		return err
	}
	return nil
}
1368909
func (c *DeleteManyBuildsCall) Tag(tag ...string) *DeleteManyBuildsCall {
	c.urlParams_.SetMulti("tag", append([]string{}, tag...))
	return c
}
671958
func (m *MockCommonAPIClient) ImageTag(ctx context.Context, image, ref string) error {
	ret := m.ctrl.Call(m, "ImageTag", ctx, image, ref)
	ret0, _ := ret[0].(error)
	return ret0
}
992219
func NormalizeImageStreamTag(name string) string {
	stripped, tag, ok := SplitImageStreamTag(name)
	if !ok {
		// Default to latest
		return JoinImageStreamTag(stripped, tag)
	}
	return name
}
965390
func Convert_image_ImageStreamTag_To_v1_ImageStreamTag(in *image.ImageStreamTag, out *v1.ImageStreamTag, s conversion.Scope) error {
	return autoConvert_image_ImageStreamTag_To_v1_ImageStreamTag(in, out, s)
}
1262544
func makeACLETag(parent string, policy *acl.Policy) string {
	return fmt.Sprintf("%s:%s", parent, policy.ID)
}
1330007
func (f Form) FileTag(opts tags.Options) *tags.Tag {
	if opts["type"] == nil {
		opts["type"] = "file"
	}
	if opts["type"] == "file" {
		f.Options["enctype"] = "multipart/form-data"
	}
	return f.InputTag(opts)
}
136865
func (_class VLANClass) GetTag(sessionID SessionRef, self VLANRef) (_retval int, _err error) {
	_method := "VLAN.get_tag"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertVLANRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertIntToGo(_method + " -> ", _result.Value)
	return
}
18207
func HasTag(image string) bool {
	tagRegex := regexp.MustCompile(tagRegexStr)
	return tagRegex.MatchString(image)
}
208226
func (c *connection) ImageByTag(namespace, name, tag string) (*Image, error) {
	if len(namespace) == 0 && reference.IsRegistryDockerHub(c.url.Host) {
		namespace = "library"
	}
	if len(name) == 0 {
		return nil, fmt.Errorf("image name must be specified")
	}
	searchTag := tag
	if len(searchTag) == 0 {
		searchTag = "latest"
	}

	repo, err := c.getCachedRepository(fmt.Sprintf("%s/%s", namespace, name))
	if err != nil {
		return nil, err
	}

	image, _, err := repo.getTaggedImage(c, searchTag, tag)
	return image, err
}
1217264
func (coff *Coff) Arch(arch string) error {
	switch arch {
	case "386":
		coff.Machine = pe.IMAGE_FILE_MACHINE_I386
	case "amd64":
		// Sources:
		// https://github.com/golang/go/blob/0e23ca41d99c82d301badf1b762888e2c69e6c57/src/debug/pe/pe.go#L116
		// https://github.com/yasm/yasm/blob/7160679eee91323db98b0974596c7221eeff772c/modules/objfmts/coff/coff-objfmt.c#L38
		// FIXME: currently experimental -- not sure if something more doesn't need to be changed
		coff.Machine = pe.IMAGE_FILE_MACHINE_AMD64
	default:
		return errors.New("coff: unknown architecture: " + arch)
	}
	return nil
}
800987
func (img *Image) Tag(tag string, push bool) (*Image, error) {

	iid, err := commons.ParseImageID(tag)
	if err != nil {
		return nil, err
	}

	dc, err := getDockerClient()
	if err != nil {
		return nil, err
	}

	args := struct {
		uuid     string
		name     string
		repo     string
		registry string
		tag      string
	}{img.UUID, img.ID.String(), iid.BaseName(), iid.Registry(), iid.Tag}

	glog.V(1).Infof("tagging image %s as: %s", args.repo, args.tag)
	opts := dockerclient.TagImageOptions{Repo: args.repo, Tag: args.tag, Force: true}
	err = dc.TagImage(args.name, opts)
	if err != nil {
		glog.V(1).Infof("unable to tag image %s: %v", args.repo, err)
		return nil, err
	}

	iid, err = commons.ParseImageID(fmt.Sprintf("%s:%s", args.repo, args.tag))
	if err != nil {
		return nil, err
	}

	if push {
		err = pushImage(args.repo, args.registry, args.tag)
	}

	return &Image{args.uuid, *iid}, err
}
679474
func (l *Slog) Tag(tags ...string) *Slog {
	l = l.copy()
	l.Log.Tags.Clean()
	l.Log.Tags.Add(tags...)
	return l
}