Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go get fails: cli.StringFlag does not implement cli.Flag #71

Closed
lalten opened this issue Feb 5, 2020 · 11 comments · Fixed by #75
Closed

go get fails: cli.StringFlag does not implement cli.Flag #71

lalten opened this issue Feb 5, 2020 · 11 comments · Fixed by #75

Comments

@lalten
Copy link

lalten commented Feb 5, 2020

When I tried to install using go get:

$ go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html
# github.com/buildkite/terminal-to-html/cmd/terminal-to-html
gopath/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:92:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:97:15: 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)
gopath/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:102:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment
$ go version
go version go1.10.4 linux/amd64
@ticky
Copy link
Contributor

ticky commented Feb 12, 2020

Looks like this is due to urfave/cli#925, and the fact that go didn't have module versioning at the time we built this.

I think we need to follow urfave/cli#921 to upgrade our API to use the new version, and we should probably update the go 1.11 module system while we're at it. Unfortunately, this would mean you will need to be running a newer go version @lalten.

@ticky
Copy link
Contributor

ticky commented Feb 12, 2020

Looking at it more closely, it looks like the issue is actually just that you're using an old version of Go: we're currently using the module system, which means you will need to use go 1.11 or newer, or things will fail!

@ashlinchak
Copy link

ashlinchak commented Mar 2, 2020

@ticky the same error for me with using the newest go version:

$ go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html
# github.com/buildkite/terminal-to-html/cmd/terminal-to-html
../../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:92:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:97:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
	cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:102:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment
$ go version
go version go1.14 linux/amd64

@ticky
Copy link
Contributor

ticky commented Mar 3, 2020

Hi @ashlinchak, could you try running the command like this for us, I think I’ve figured out what’s gone wrong:

GO111MODULE=on go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html

@ashlinchak
Copy link

@ticky got another error with dependencies:

GO111MODULE=on go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html
go: downloading github.com/buildkite/terminal-to-html v1.0.2
go: downloading github.com/buildkite/terminal-to-html v3.2.0+incompatible
go: found github.com/buildkite/terminal-to-html/cmd/terminal-to-html in github.com/buildkite/terminal-to-html v3.2.0+incompatible
go: finding module for package github.com/buildkite/terminal
go: finding module for package github.com/codegangsta/cli
go: downloading github.com/buildkite/terminal v1.0.2
go: downloading github.com/codegangsta/cli v1.22.2
go: downloading github.com/buildkite/terminal v3.2.0+incompatible
go: found github.com/buildkite/terminal in github.com/buildkite/terminal v3.2.0+incompatible
go: found github.com/codegangsta/cli in github.com/codegangsta/cli v1.22.2
go: github.com/buildkite/terminal-to-html/cmd/terminal-to-html imports
	github.com/codegangsta/cli: github.com/codegangsta/cli@v1.22.2: parsing go.mod:
	module declares its path as: github.com/urfave/cli
	        but was required as: github.com/codegangsta/cli

@ashlinchak
Copy link

I believe this should fix this.

@yob
Copy link
Contributor

yob commented Mar 5, 2020

Hi @ashlinchak. We've merged that PR - has it resolved your compilation error?

@caramdache
Copy link

I just installed go and am running into the same issues despite the fix:

$ go version
go version go1.14.2 linux/amd64

Simple install:

$ go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html
# github.com/buildkite/terminal-to-html/cmd/terminal-to-html
../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:92:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
        cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:97:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
        cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
../go/src/github.com/buildkite/terminal-to-html/cmd/terminal-to-html/terminal-to-html.go:102:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment

Other attempt:

$ GO111MODULE=on go get github.com/buildkite/terminal-to-html/cmd/terminal-to-html
go: downloading github.com/buildkite/terminal-to-html v1.0.2
go: downloading github.com/buildkite/terminal-to-html v3.2.0+incompatible
go: found github.com/buildkite/terminal-to-html/cmd/terminal-to-html in github.com/buildkite/terminal-to-html v3.2.0+incompatible
go: finding module for package github.com/codegangsta/cli
go: finding module for package github.com/buildkite/terminal
go: downloading github.com/buildkite/terminal v1.0.2
go: downloading github.com/codegangsta/cli v1.22.4
go: downloading github.com/buildkite/terminal v3.2.0+incompatible
go: found github.com/buildkite/terminal in github.com/buildkite/terminal v3.2.0+incompatible
go: found github.com/codegangsta/cli in github.com/codegangsta/cli v1.22.4
go: github.com/buildkite/terminal-to-html/cmd/terminal-to-html imports
        github.com/codegangsta/cli: github.com/codegangsta/cli@v1.22.4: parsing go.mod:
        module declares its path as: github.com/urfave/cli
                but was required as: github.com/codegangsta/cli

Am I missing something?

@ticky
Copy link
Contributor

ticky commented May 12, 2020

Sorry folks, trying to get my head around what Go wants from us here.

@yob
Copy link
Contributor

yob commented Sep 12, 2020

I believe this is fixed in the 3.4.0 release. This now works for me:

$ go version
go version go1.14.7 linux/amd64

$ go get github.com/buildkite/terminal-to-html/v3
go: downloading github.com/buildkite/terminal-to-html/v3 v3.4.0
go: github.com/buildkite/terminal-to-html/v3 upgrade => v3.4.0

@yob yob closed this as completed Sep 12, 2020
@yob
Copy link
Contributor

yob commented Sep 12, 2020

if I'm wrong, I'm happy to re-open this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants