main
Tom Limoncelli 5 years ago
parent caa97b585e
commit dc7ae10a15

@ -1438,7 +1438,7 @@ Side note: quotes may be necessary around the date depending on your layout (if
v2 has a number of breaking changes but converting is relatively v2 has a number of breaking changes but converting is relatively
straightforward: make the changes documented below then resolve any straightforward: make the changes documented below then resolve any
compiler errors. We hope this will be sufficient for most typical compiler errors. We hope this will be sufficient for most typical
users. users.
If you find any issues not covered by this document, please post a If you find any issues not covered by this document, please post a
@ -1447,7 +1447,7 @@ consider sending a PR to help improve this guide.
#### Flags before args #### Flags before args
In v2 flags must come before args. This is more POSIX-compliant. You In v2 flags must come before args. This is more POSIX-compliant. You
may need to update scripts, user documentation, etc. may need to update scripts, user documentation, etc.
This will work: This will work:
@ -1473,17 +1473,17 @@ Shell command to find them all: `fgrep -rl github.com/urfave/cli *`
#### Flag aliases are done differently. #### Flag aliases are done differently.
Change `Name: "foo, f` to "Name: "foo", Aliases: []string{"f"}` Change `Name: "foo, f"` to `Name: "foo", Aliases: []string{"f"}`
* OLD: * OLD:
``` ```go
cli.StringFlag{ cli.StringFlag{
Name: "config, cfg" Name: "config, cfg"
} }
``` ```
* NEW: * NEW:
``` ```go
cli.StringFlag{ cli.StringFlag{
Name: "config", Name: "config",
Aliases: []string{"cfg"}, Aliases: []string{"cfg"},
@ -1508,8 +1508,8 @@ Example:
Compiler messages you might see: Compiler messages you might see:
``` ```
commands/commands.go:56:30: cannot convert commands (type []cli.Command) to type cli.CommandsByName cannot convert commands (type []cli.Command) to type cli.CommandsByName
commands/commands.go:57:15: cannot use commands (type []cli.Command) as type []*cli.Command in assignment cannot use commands (type []cli.Command) as type []*cli.Command in assignment
``` ```
#### Lists of commands should be pointers #### Lists of commands should be pointers
@ -1523,7 +1523,7 @@ now be pointers.
Compiler messages you might see: Compiler messages you might see:
``` ```
./commands.go:32:34: cannot use cli.Command literal (type cli.Command) as type *cli.Command in argument to cannot use cli.Command literal (type cli.Command) as type *cli.Command in argument to
``` ```
#### cli.Flag changed #### cli.Flag changed
@ -1536,13 +1536,13 @@ If you make a list of flags, add a `&` in front of each
item. cli.BoolFlag, cli.StringFlag, etc. item. cli.BoolFlag, cli.StringFlag, etc.
* OLD: * OLD:
``` ```go
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
cli.BoolFlag{ cli.BoolFlag{
``` ```
* NEW: * NEW:
``` ```go
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
``` ```
@ -1564,7 +1564,7 @@ now pointers.
Compiler messages you might see: Compiler messages you might see:
``` ```
commands/commands.go:28:19: cannot use c (type *cli.Command) as type cli.Command in append cannot use c (type *cli.Command) as type cli.Command in append
``` ```
#### Actions returns errors #### Actions returns errors
@ -1577,7 +1577,7 @@ A command's `Action:` now returns an `error`.
Compiler messages you might see: Compiler messages you might see:
``` ```
./commands.go:35:2: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in field value cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in field value
``` ```
#### Everything else #### Everything else

Loading…
Cancel
Save