Skip to content

Commit

Permalink
#13 fixed lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Mar 26, 2019
1 parent 52beb32 commit 7046d81
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
3 changes: 0 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ func NewXrnApp(logger log.Logger, db dbm.DB, postgresUrl string) *xrnApp {

app.upgradeKeeper = upgrade.NewKeeper(app.upgradeStoreKey, cdc)
app.upgradeKeeper.SetDoShutdowner(app.shutdownOnUpgrade)
app.upgradeKeeper.SetUpgradeHandler("test3", func(ctx sdk.Context, plan upgrade.Plan) {
ctx.Logger().Info("In upgrade 3 handler!")
})

app.consortiumKeeper = consortium.NewKeeper(app.consortiumStoreKey, cdc, app.agentKeeper, app.upgradeKeeper)

Expand Down
1 change: 1 addition & 0 deletions x/upgrade/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"
)

// GetQueryCmd creates a query sub-command for the upgrade module using cmdName as the name of the sub-command.
func GetQueryCmd(cmdName string, storeName string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: cmdName,
Expand Down
1 change: 1 addition & 0 deletions x/upgrade/client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http"
)

// RegisterRoutes registers REST routes for the upgrade module under the path specified by routeName.
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec, routeName string, storeName string) {
r.HandleFunc(fmt.Sprintf("/%s", routeName), getUpgradePlanHandler(cdc, cliCtx, storeName)).Methods("GET")
}
Expand Down
1 change: 1 addition & 0 deletions x/upgrade/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Keeper struct {
}

const (
// PlanKey specifies the key under which an upgrade plan is stored in the store
PlanKey = "plan"
)

Expand Down
17 changes: 8 additions & 9 deletions x/upgrade/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ type Plan struct {
Info string `json:"info,omitempty"`
}

// UpgradeHandler specifies the type of function that is called when an upgrade is applied
// Handler specifies the type of function that is called when an upgrade is applied
type Handler func(ctx sdk.Context, plan Plan)

func (plan Plan) String() string {
var whenStr string
if !plan.Time.IsZero() {
return fmt.Sprintf(`Upgrade Plan
Name: %s
Time: %s
Info: %s`, plan.Name, plan.Time.Format(time.RFC3339), plan.Info)
whenStr = fmt.Sprintf("Time: %s", plan.Time.Format(time.RFC3339))
} else {
return fmt.Sprintf(`Upgrade Plan
Name: %s
Height: %d
Info: %s`, plan.Name, plan.Height, plan.Info)
whenStr = fmt.Sprintf("Height: %d", plan.Height)
}
return fmt.Sprintf(`Upgrade Plan
Name: %s
%s
Info: %s`, plan.Name, whenStr, plan.Info)
}

0 comments on commit 7046d81

Please sign in to comment.