Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
robdefeo committed Mar 7, 2020
1 parent 102a9c4 commit 3c6b59c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions cmd/nameservice/commands/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ package commands

// Execute run the command
func Execute() error {
root, err := rootCmd()
if err != nil {
return err
}
return root.Execute()
return rootCmd().Execute()
}
10 changes: 5 additions & 5 deletions cmd/nameservice/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ func addENS(router *mux.Router) error {
return nil
}

func addItem(router *mux.Router, network, protocol string, service nameservice.Lookup) {
router.HandleFunc(fmt.Sprintf("/%s/%s/name", protocols.Ethereum, ethereum.Mainnet), handler.Forward(service, protocols.Ethereum, ethereum.Mainnet)).Methods("GET")
router.HandleFunc(fmt.Sprintf("/%s/%s/address", protocols.Ethereum, ethereum.Mainnet), handler.Reverse(service, protocols.Ethereum, ethereum.Mainnet)).Methods("GET")
func addItem(router *mux.Router, protocol, network string, service nameservice.Lookup) {
router.HandleFunc(fmt.Sprintf("/%s/%s/name", protocol, network), handler.Forward(service, protocol, network)).Methods("GET")
router.HandleFunc(fmt.Sprintf("/%s/%s/address", protocol, network), handler.Reverse(service, protocol, network)).Methods("GET")
}

// {protocol}/{network}/name/?domain-name={domain-name}
// {protocol}/{network}/address?address={address}
func rootCmd() (*cobra.Command, error) {
func rootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "nameservice",
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -53,5 +53,5 @@ func rootCmd() (*cobra.Command, error) {
}
cmd.PersistentFlags().Int("port", 8080, "")

return cmd, nil
return cmd
}
2 changes: 1 addition & 1 deletion cmd/nameservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (

func main() {
if err := commands.Execute(); err != nil {
log.Fatalln(err)
log.Fatalf("%+v\n", err)
}
}

0 comments on commit 3c6b59c

Please sign in to comment.