Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jan 9, 2025
1 parent c70fdac commit 9a9e6bd
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ignite/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To get started, create a blockchain:
SilenceUsage: true,
SilenceErrors: true,
Args: cobra.MinimumNArgs(0), // note(@julienrbrt): without this, ignite __complete(noDesc) hidden commands are not working.
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// Check for new versions only when shell completion scripts are not being
// generated to avoid invalid output to stdout when a new version is available
if cmd.Use != "completion" || !strings.HasPrefix(cmd.Use, cobra.ShellCompRequestCmd) {
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func NewDoctor() *cobra.Command {
Use: "doctor",
Short: "Fix chain configuration",
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
session := cliui.New()
defer session.End()

Expand Down
4 changes: 2 additions & 2 deletions ignite/cmd/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func NewAppList() *cobra.Command {
Use: "list",
Short: "List installed apps",
Long: "Prints status and information of all installed Ignite Apps.",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
s := cliui.New(cliui.WithStdout(os.Stdout))
return printPlugins(cmd.Context(), s)
},
Expand All @@ -433,7 +433,7 @@ func NewAppUpdate() *cobra.Command {
If no path is specified all declared apps are updated.`,
Example: "ignite app update github.com/org/my-app/",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
if len(args) == 0 {
// update all plugins
return plugin.Update(plugins...)
Expand Down
14 changes: 7 additions & 7 deletions ignite/config/plugins/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ import (
// given names above are found, then an empty config is returned, w/o errors.
func ParseDir(dir string) (*Config, error) {
// handy function that wraps and prefix err with a common label
errf := func(err error) (*Config, error) {
return nil, errors.Errorf("plugin config parse: %w", err)
errf := func(err error) error {
return errors.Errorf("plugin config parse: %w", err)
}
fi, err := os.Stat(dir)
if err != nil {
return errf(err)
return nil, errf(err)
}
if !fi.IsDir() {
return errf(errors.Errorf("path %s is not a dir", dir))
return nil, errf(errors.Errorf("path %s is not a dir", dir))
}

filename, err := locateFile(dir)
if err != nil {
return errf(err)
return nil, errf(err)
}
c := Config{
path: filename,
Expand All @@ -41,13 +41,13 @@ func ParseDir(dir string) (*Config, error) {
if os.IsNotExist(err) {
return &c, nil
}
return errf(err)
return nil, errf(err)
}
defer f.Close()

// if the error is end of file meaning an empty file on read return nil
if err := yaml.NewDecoder(f).Decode(&c); err != nil && !errors.Is(err, io.EOF) {
return errf(err)
return nil, errf(err)
}
return &c, nil
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/cosmostxcollector/adapter/postgres/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s Schemas) WalkFrom(fromVersion uint64, fn SchemasWalkFunc) error {
paths := map[uint64]string{}

// Index the paths to the schemas with the matching versions
err := fs.WalkDir(s.fs, SchemasDir, func(path string, d fs.DirEntry, err error) error {
err := fs.WalkDir(s.fs, SchemasDir, func(path string, _ fs.DirEntry, err error) error {
if err != nil {
return errors.Errorf("failed to read schema %s: %w", path, err)
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/openapiconsole/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var index embed.FS
func Handler(title, specURL string) http.HandlerFunc {
t, _ := template.ParseFS(index, "index.tpl")

return func(w http.ResponseWriter, req *http.Request) {
return func(w http.ResponseWriter, _ *http.Request) {
_ = t.Execute(w, struct {
Title string
URL string
Expand Down
6 changes: 3 additions & 3 deletions ignite/pkg/protoanalysis/protoutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func GetMessageByName(f *proto.Proto, name string) (node *proto.Message, err err
return ok
},
// return immediately iff found.
func(c *Cursor) bool { return !found })
func(*Cursor) bool { return !found })
if found {
return
}
Expand Down Expand Up @@ -210,7 +210,7 @@ func GetServiceByName(f *proto.Proto, name string) (node *proto.Service, err err
return ok
},
// return immediately iff found.
func(c *Cursor) bool { return !found })
func(*Cursor) bool { return !found })
if found {
return
}
Expand Down Expand Up @@ -241,7 +241,7 @@ func GetImportByPath(f *proto.Proto, path string) (node *proto.Import, err error
return ok
},
// return immediately iff found.
func(c *Cursor) bool { return !found })
func(*Cursor) bool { return !found })
if found {
return
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func SingletonType() AddTypeKind {

// DryType only creates a type with a basic definition.
func DryType() AddTypeKind {
return func(o *addTypeOptions) {}
return func(*addTypeOptions) {}
}

// TypeWithModule module to scaffold type into.
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/field/datatype/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var DataCustom = DataType{
ProtoType: func(datatype, name string, index int) string {
return fmt.Sprintf("%s %s = %d", datatype, name, index)
},
GenesisArgs: func(name multiformatname.Name, value int) string {
GenesisArgs: func(name multiformatname.Name, _ int) string {
return fmt.Sprintf("%s: new(types.%s),\n", name.UpperCamel, name.UpperCamel)
},
CLIArgs: func(name multiformatname.Name, datatype, prefix string, argIndex int) string {
Expand Down

0 comments on commit 9a9e6bd

Please sign in to comment.