buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
642 stars 45 forks source link

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

Closed lalten closed 3 years ago

lalten commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

I believe this should fix this.

yob commented 4 years ago

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

caramdache commented 4 years ago

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 commented 4 years ago

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

yob commented 3 years ago

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 commented 3 years ago

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