From 5f402cf134395f3064096ceced44c366f69f51de Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Mon, 4 Jan 2021 23:07:03 +0000 Subject: [PATCH] Compilable version --- cmd/root.go | 2 +- cmd/ud.go | 31 ++++++++++++++++++++----------- go.mod | 2 +- go.sum | 1 + 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 439cf5a7c..a08ad1d0c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -21,7 +21,7 @@ import ( "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/switchboard" - w "gitlab.com/xx_network/primitives/id" + "gitlab.com/xx_network/primitives/id" "io/ioutil" "os" "strconv" diff --git a/cmd/ud.go b/cmd/ud.go index f35a44af6..8f9709dec 100644 --- a/cmd/ud.go +++ b/cmd/ud.go @@ -9,6 +9,7 @@ package cmd import ( + "fmt" "github.com/spf13/cobra" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" @@ -17,6 +18,7 @@ import ( "gitlab.com/elixxir/client/switchboard" "gitlab.com/elixxir/client/ud" "gitlab.com/elixxir/primitives/fact" + "time" ) // udCmd user discovery subcommand, allowing user lookup and registration for @@ -65,7 +67,7 @@ var udCmd = &cobra.Command{ }) } - err := client.StartNetworkFollower() + err = client.StartNetworkFollower() if err != nil { jww.FATAL.Panicf("%+v", err) } @@ -83,7 +85,7 @@ var udCmd = &cobra.Command{ } } - var facts []fact.Fact + var facts fact.FactList phone := viper.GetString("addphone") if phone != "" { f, err := fact.NewFact(fact.Phone, phone) @@ -129,21 +131,24 @@ var udCmd = &cobra.Command{ lookupIDStr) } userDiscoveryMgr.Lookup(lookupID, - func(newContact contact.Contact, err Error) { + func(newContact contact.Contact, err error) { if err != nil { jww.FATAL.Panicf("%+v", err) } - fmt.Printf(newContact.String()) + cBytes, err := newContact.Marshal() + if err != nil { + jww.FATAL.Panicf("%+v", err) + } + fmt.Printf(string(cBytes)) }, time.Duration(10*time.Second)) time.Sleep(11 * time.Second) } usernameSrchStr := viper.GetString("searchusername") - emailSrchStr := viper.GetSTring("searchemail") - phoneSrchStr := viper.GetSTring("searchphone") + emailSrchStr := viper.GetString("searchemail") + phoneSrchStr := viper.GetString("searchphone") - var facts FactList if usernameSrchStr != "" { f, err := fact.NewFact(fact.Username, usernameSrchStr) if err != nil { @@ -167,24 +172,28 @@ var udCmd = &cobra.Command{ } if len(facts) == 0 { - client.StopNetworkFollowers(10 * time.Second) + client.StopNetworkFollower(10 * time.Second) return } - err := userDiscoveryMgr.Search(facts, + err = userDiscoveryMgr.Search(facts, func(contacts []contact.Contact, err error) { if err != nil { jww.FATAL.Panicf("%+v", err) } for i := 0; i < len(contacts); i++ { - fmt.Printf(contacts[i].String()) + cBytes, err := contacts[i].Marshal() + if err != nil { + jww.FATAL.Panicf("%+v", err) + } + fmt.Printf(string(cBytes)) } }, 10*time.Second) if err != nil { jww.FATAL.Panicf("%+v", err) } time.Sleep(11 * time.Second) - client.StopNetworkFollowers(10 * time.Second) + client.StopNetworkFollower(10 * time.Second) }, } diff --git a/go.mod b/go.mod index f9653e17d..9ad5bef1b 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( gitlab.com/elixxir/primitives v0.0.3-0.20210104223605-0e47af99d9d5 gitlab.com/xx_network/comms v0.0.4-0.20201222193955-56206d700360 gitlab.com/xx_network/crypto v0.0.5-0.20201217195719-cc31e1d1eee3 - gitlab.com/xx_network/primitives v0.0.4-0.20201229212313-fe33d9809f27 + gitlab.com/xx_network/primitives v0.0.4-0.20201216174909-808eb0fc97fc golang.org/x/crypto v0.0.0-20201217014255-9d1352758620 golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e // indirect diff --git a/go.sum b/go.sum index 6d40abb69..ab612e88b 100644 --- a/go.sum +++ b/go.sum @@ -307,6 +307,7 @@ gitlab.com/xx_network/primitives v0.0.2 h1:r45yKenJ9e7PylI1ZXJ1Es09oYNaYXjxVy9+u gitlab.com/xx_network/primitives v0.0.2/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= gitlab.com/xx_network/primitives v0.0.3 h1:RBJGPtphUyDvN8iG8+VTF8tr5iT9f5WHo0NCbenspYE= gitlab.com/xx_network/primitives v0.0.3/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= +gitlab.com/xx_network/primitives v0.0.4-0.20201216174909-808eb0fc97fc h1:nZ0kNhQfkEr4TIpf1MQxOIWiSd1M1YTE2JrFA1SPSD4= gitlab.com/xx_network/primitives v0.0.4-0.20201216174909-808eb0fc97fc/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= gitlab.com/xx_network/primitives v0.0.4-0.20201229212313-fe33d9809f27 h1:JGpYRKkhPw58dlhii/wH8N9uWZ1AOTyVw3b6ZYdndA8= gitlab.com/xx_network/primitives v0.0.4-0.20201229212313-fe33d9809f27/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= -- GitLab