packagecommandsimport("errors""fmt""io""github.com/jbenet/go-ipfs/core")funcResolve(n*core.IpfsNode,args[]string,optsmap[string]interface{},outio.Writer)error{name:=""switchlen(args){case1:name=args[0]case0:ifn.Identity==nil{returnerrors.New("Identity not loaded!")}name=n.Identity.ID().String()default:returnfmt.Errorf("Publish expects 1 or 2 args; got %d.",len(args))}res,err:=n.Namesys.Resolve(name)iferr!=nil{returnerr}fmt.Fprintf(out,"%s\n",res)returnnil}