You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: avatars.go
    path of file: ./repos/client/go/service
    
    the code of the file until where you have to start completion: package service

import (
	"encoding/json"
	"fmt"
	"strings"

	"github.com/keybase/client/go/gregor"
	"github.com/keybase/client/go/libkb"
	gregor1 "github.com/keybase/client/go/protocol/gregor1"
	keybase1 "github.com/keybase/client/go/protocol/keybase1"
	"github.com/keybase/go-framed-msgpack-rpc/rpc"

	"golang.org/x/net/context"
)

type AvatarHandler struct {
	libkb.Contextified
	*BaseHandler
	source libkb.AvatarLoader
    
func (r *avatarGregorHandler) clearName(ctx context.Context, cli gregor1.IncomingInterface, item gregor.Item) error {
	m := libkb.NewMetaContext(ctx, r.G())
	m.Debug("avatarGregorHandler: avatar.clear_cache_for_name received")
	var msgs []keybase1.AvatarClearCacheMsg
	if err := json.Unmarshal(item.Body().Bytes(), &msgs); err != nil {
		m.Debug("error unmarshaling avatar.clear_cache_for_name item: %s", err)
		return err
	}

	m.Debug("avatar.clear_cache_for_name unmarshaled: %+v", msgs)

	for _, msg := range msgs {
		if err := r.source.ClearCacheForName(m, msg.Name, msg.Formats); err != nil {
			return err
		}
		r.G().NotifyRouter.HandleAvatarUpdated(ctx, msg.Name, msg.Formats, msg.Typ)
	}

	return r.G().GregorState.DismissItem(ctx, cli, item.Metadata().MsgID())
}