// Link resolves references made by fields inside the FieldGroup.
358232
func (fg FieldGroup) Link(scope Scope) error {
	for _, field := range fg {
		if err := field.Link(scope); err != nil {
			return err
		}
	}

	return nil
}
278654
func (this *Response) Links(link string, rel string) {
	links := this.Get("Link")
	if len(links) > 0 {
		links = links + ", "
	}
	this.Set("Link", links+"<"+link+">; rel=\""+rel+"\"")
}
666617
func (o *NSRedundantGatewayGroup) ShuntLinks(info *bambou.FetchingInfo) (ShuntLinksList, *bambou.Error) {

	var list ShuntLinksList
	err := bambou.CurrentSession().FetchChildren(o, ShuntLinkIdentity, &list, info)
	return list, err
}
1110410
func (d *driver) Readlink(p string) (string, error) {
	return os.Readlink(p)
}
1210100
func (l *linkIndex) link(parent, child *container.Container, alias string) {
	l.mu.Lock()

	if l.idx[parent] == nil {
		l.idx[parent] = make(map[string]*container.Container)
	}
	l.idx[parent][alias] = child
	if l.childIdx[child] == nil {
		l.childIdx[child] = make(map[*container.Container]map[string]struct{})
	}
	if l.childIdx[child][parent] == nil {
		l.childIdx[child][parent] = make(map[string]struct{})
	}
	l.childIdx[child][parent][alias] = struct{}{}

	l.mu.Unlock()
}
299097
func (c ConstantString) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	// TODO(abg): Are binary literals a thing?
	if _, ok := RootTypeSpec(t).(*StringSpec); !ok {
		return nil, constantValueCastError{Value: c, Type: t}
	}
	return c, nil
}
536409
func (b *Build) BuilderLink() *Link {
	if b.Builder == nil {
		panic("Invalid build")
	}
	builder := b.Builder
	return NewLink(
		builder.Builder,
		fmt.Sprintf("/p/%s/builders/%s/%s", builder.Project, builder.Bucket, builder.Builder),
		fmt.Sprintf("Builder %s in bucket %s", builder.Builder, builder.Bucket))
}
327036
func (f *fieldLookup) VisitReference(r proto.Reference) {
	if f.SaveLeafSchema(r) {
		return
	}

	// Passthrough references.
	r.SubSchema().Accept(f)
}
449805
func (bs *blobStore) link(ctx context.Context, path string, dgst digest.Digest) error {
	// The contents of the "link" file are the exact string contents of the
	// digest, which is specified in that package.
	return bs.driver.PutContent(ctx, path, []byte(dgst))
}
1168916
func (l *linkIndex) unlink(alias string, child, parent *container.Container) {
	l.mu.Lock()
	delete(l.idx[parent], alias)
	delete(l.childIdx[child], parent)
	l.mu.Unlock()
}
1112842
func (sc *Client) ResolveSymlink(path string) string {
	pointer, err := sc.ReadLink(path)
	if err != nil {
		return path
	}
	return pointer
}
256009
func (p proof) findLink(ctx context.Context, g *libkb.GlobalContext, world LoaderContext, leafID keybase1.UserOrTeamID, seqno keybase1.Seqno, firstLinkMap linkMapT, proofSet *proofSetT) (linkID keybase1.LinkID, err error) {
	lm := firstLinkMap

	if leafID.IsTeamOrSubteam() {
		// Pull in the latest link map, instead of the one from the proof object.
		tid := leafID.AsTeamOrBust()
		lm2, ok := proofSet.teamLinkMaps[tid]
		if ok {
			lm = lm2
		}
	}
	if lm == nil {
		return linkID, NewProofError(p, "nil link map")
	}

	linkID, ok := lm[seqno]
	if ok {
		return linkID, nil
	}

	// We loaded this user originally to get a sigchain as fresh as a certain key provisioning.
	// In this scenario, we might need a fresher version, so force a poll all the way through
	// the server, and then try again. If we fail the second time, we a force repoll, then
	// we're toast.
	if leafID.IsUser() {
		g.Log.CDebugf(ctx, "proof#findLink: missed load for %s at %d; trying a force repoll", leafID.String(), seqno)
		lm, err := world.forceLinkMapRefreshForUser(ctx, leafID.AsUserOrBust())
		if err != nil {
			return linkID, err
		}
		linkID, ok = lm[seqno]
	}

	if !ok {
		return linkID, NewProofError(p, fmt.Sprintf("no linkID for seqno %d", seqno))
	}
	return linkID, nil
}
365037
func AddLink(link *Link, obj ModelObj) {
	link.ObjType = obj.GetType()
	link.ObjKey = obj.GetKey()
}
1339413
func (s *Switch) GetLink(chanID lnwire.ChannelID) (ChannelLink, error) {
	s.indexMtx.RLock()
	defer s.indexMtx.RUnlock()

	return s.getLink(chanID)
}
1076736
func (b *Build) Link() *Link {
	if b.Builder == nil {
		panic("invalid build")
	}
	num := b.Id
	if b.Number != 0 {
		num = int64(b.Number)
	}
	builder := b.Builder
	return NewLink(
		fmt.Sprintf("%d", num),
		fmt.Sprintf("/p/%s/builders/%s/%s/%d", builder.Project, builder.Bucket, builder.Builder, num),
		fmt.Sprintf("Build %d", num))
}
1290464
func (l *ListSpec) Link(scope Scope) (TypeSpec, error) {
	if l.linked() {
		return l, nil
	}

	var err error
	l.ValueSpec, err = l.ValueSpec.Link(scope)
	return l, err
}
1186260
func (c *TokenController) Link(ctx *app.LinkTokenContext) error {
	if ctx.For == "" {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("for", "").Expected("git or OpenShift resource URL"))
	}
	currentIdentity, err := c.app.UserService().ContextIdentityIfExists(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	var redirectURL string
	if ctx.Redirect == nil {
		redirectURL = ctx.RequestData.Header.Get("Referer")
		if redirectURL == "" {
			return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("redirect", "empty").Expected("redirect param or Referer header should be specified"))
		}
	} else {
		redirectURL = *ctx.Redirect
	}

	redirectLocation, err := c.app.LinkService().ProviderLocation(ctx, ctx.RequestData, currentIdentity.String(), ctx.For, redirectURL)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	locationPayload := &app.RedirectLocation{RedirectLocation: redirectLocation}
	return ctx.OK(locationPayload)
}