Cli: Getting "DEPRECATED Action signature. Must be `cli.ActionFunc`"

Created on 1 May 2016  路  5Comments  路  Source: urfave/cli

Our applicaiton working for months.
Recompiled today with latest cli update and we get this warning:

DEPRECATED Action signature.  Must be `cli.ActionFunc`
kinquestion

Most helpful comment

I don't know if you were able to resolve this @efairon but I also got this a few days ago and I was able to fix it by now returning an error on the Action: func().

For example:

app.Commands = []cli.Command{
  {
    Name:    "search",
    Aliases: []string{"s"},
    Usage:   "Search go packages on gophr.pm",
    Action:  RunSearchCommand,
  }
}
func RunSearchCommand(c *cli.Context) error {
  ...
}

Doesn't give me the DEPRECATED Action signature. Must be 'cli.ActionFunc' message anymore.

All 5 comments

Hi @efairon!

This work was recently merged and released.

We are following semantic versioning and so this work involved bumping the minor version. We recommend pinning the version of this library to a particular minor version (using one of the many pinning tools) if you do not want to encounter deprecations (or vendoring).

You can see the CHANGELOG for the full list of changes.

Let me know what you think though! We've recently picked up steam again and are working through to make long overdue improvements to the library. We aim to do this in a backwards compatible fashion where possible, but this does involve deprecation of the usage of certain APIs to improve the overall API.

fwiw I've just merged some clarifications so that all deprecation warnings now include URLs to the relevant entry in the CHANGELOG :wave:

Ok clear. Thanks a lot.

I don't know if you were able to resolve this @efairon but I also got this a few days ago and I was able to fix it by now returning an error on the Action: func().

For example:

app.Commands = []cli.Command{
  {
    Name:    "search",
    Aliases: []string{"s"},
    Usage:   "Search go packages on gophr.pm",
    Action:  RunSearchCommand,
  }
}
func RunSearchCommand(c *cli.Context) error {
  ...
}

Doesn't give me the DEPRECATED Action signature. Must be 'cli.ActionFunc' message anymore.

@Shikkic Yes since we return error we got no problrm anymore. I should have written it in my previous comment.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings