_Here is the fix for this issue! => https://github.com/urfave/cli/issues/925#issuecomment-559330456_
_edited by @lynncyrin!_
After the last 2 months there was an error:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
In commit ebc25651f0fc5d51acf8182565706d670edff596 error not exists.
In corrent master error exists.
I don't think this has enough details to understand the problem.
Do you have a reproduction example, of code that worked and now doesn't?
What go version are you using,? Are you using go modules? Which version of the library you are using?
Stumbled upon that as well. We have code as follows
runFlags := []cli.Flag{
cli.BoolFlag{
Name: flagDownload,
Usage: "download any missing imports (as the get command does)",
},
cli.BoolFlag{
Name: "update",
Usage: "update all dependencies to the latest versions",
},
}
It produces this error message:
lang/gapi.go:79:16: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
HTH!
Let me guess, you are not using go modules or any form of vendoring and pull stuff straight from master and build against that?
You know, I had this same question 馃槄 and our main author has it covered:
https://github.com/purpleidea/mgmt/blob/master/docs/faq.md#why-arent-you-using-glide-godep-or-go-mod-for-dependency-management
I have since been informed that we'll probably need to update this code to match the API change. (On it.)
Well this was an intended change to a new version of the API, so I guess you just have to fix your side of things.
We expect potentially one more of these breaking changes next year.
ok, but change manual.md , line 547:
package main
import (
"log"
"os"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Flags = []cli.Flag {
cli.StringFlag{
Name: "password, p",
Usage: "password for the mysql database",
FilePath: "/etc/mysql/password",
},
}
@skillful-alex please refer to the v2 manual for the latest documentation.
For any Go noobs out there like me, here's how I repaired my app:
1) Remove any instances of required packages from your $GO_PATH/src/
2) run go mod init github.com/<OWNER>/<REPO> in the root of your app.
3) run your package go run .
This will generate a
go.modfile pre-populated with any requirements found in imports
4) update anywhere that usesgo get -d -v(Such a as Dockerfile) to usego mod download
You can see my commit here: https://github.com/Guestlogix/pat/commit/02d048137389b8da8c7971149b7aa33100773476
Oh no! I'm so sorry everyone, we had no idea people were using the package from the master branch.
As described above, you'll want to do either of the following things:
go modules so you can pin v1, orThere's a few things we can do in this repo:
v1 => v2 migration guide https://github.com/urfave/cli/issues/921v2 manualv2 is being used by default@hussamd, @jangaraj, @maxcnunes, @sybnex, @nathancoleman-wf, @max0ne, @juansc if you are still having this issue, can you let me know where you're experiencing it? I'm trying to chase down all of the projects that need to be fixed.
2nd try ~! @hussamd, @jangaraj, @maxcnunes, @sybnex, @nathancoleman-wf, @max0ne, @juansc if any of you are still experiencing issues, please followup with me!
@lynncyrin My team pinned this repo to the last working version a while ago
Thank for that information!
It looks like everyone's issue here was that they were using this library straight from master, which causes obvious issues whenever we need to release a new major version. The fix here is to do either of the following things:
I'm going to copy paste this a few times on related issues, so that everyone is aware of the solution here.
@lynncyrin thanks for the follow up. We also pinned the repo but we'll look at the steps to migrate from v1 to v2.
I've been compiling migration instructions here => https://github.com/urfave/cli/releases/tag/v2.0.0 ^^
Most helpful comment
For any Go noobs out there like me, here's how I repaired my app:
1) Remove any instances of required packages from your
$GO_PATH/src/2) run
go mod init github.com/<OWNER>/<REPO>in the root of your app.3) run your package
go run .You can see my commit here: https://github.com/Guestlogix/pat/commit/02d048137389b8da8c7971149b7aa33100773476