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

Upgrade urfave/cli to v2 #76

Closed ticky closed 3 years ago

ticky commented 4 years ago

This, I think, will render the latest cli version actually go getable. I believe we will need to update the import path to v3 and rebuild this once #75 lands.

ticky commented 4 years ago

Okay.. I think we actually need to tag a v3.3.0 in order to test this? x_x

ticky commented 3 years ago

I believe this is ready for review!

ticky commented 3 years ago

Yep, and go doesn't let you know if you've messed up until you make it permanent! 🙃

lox commented 3 years ago

I'm not sure I understand why we are adding cmd/terminal-to-html/go.mod vs using the root go.mod? Beyond that, the version selector syntax should be github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html vs github.com/buildkite/terminal-to-html/cmd/terminal-to-html/v3 shouldn't it?

ticky commented 3 years ago

I'm not sure I understand why we are adding cmd/terminal-to-html/go.mod vs using the root go.mod?

Because the existing install instructions do not work, as from what I can tell, go get only installs modules, and unless it is a module, GO111MODULE=on go get github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html does not find any such module.

Beyond that, the version selector syntax should be github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html vs github.com/buildkite/terminal-to-html/cmd/terminal-to-html/v3 shouldn't it?

I think it needs to be the version of the module, which in this case, because cmd/terminal-to-html is being treated as a module, needs to be like this.

ticky commented 3 years ago

Right, and for clarification, the CLI and the module are two separate modules, because one depends on the other

ticky commented 3 years ago

Further research seems to suggest this isn't how we ought to be doing it, this repo suggests it should be installed without the specific cmd specified: https://github.com/golang-standards/project-layout#cmd, and that it shouldn't be a module. That being said, I believe there were previously build issues stemming from the cmd not being able to access the module it lives within.

lox commented 3 years ago

My guess is that we need to tag v4.0.0 with the correct module path of/v4!

lox commented 3 years ago
 ✗ ~ GO111MODULE=on go get -u -v github.com/buildkite/terminal-to-html/v3/...
go get github.com/buildkite/terminal-to-html/v3/...: module github.com/buildkite/terminal-to-html@upgrade found (v3.2.0+incompatible), but does not contain packages matching github.com/buildkite/terminal-to-html/v3/...
ticky commented 3 years ago

I've removed the extra module stuff, and it seems to build correctly using the "just build the cmd" method, I'm just still not entirely confident this will work as we expect when merged and tagged

yob commented 3 years ago

My guess is that we need to tag v4.0.0 with the correct module path of/v4!

I'm confused, because I was pretty sure we'd fixed the module issues in this repo by applying #75 and then creating a v3.x tag including the change.

Doesn't go get github.com/buildkite/terminal-to-html/v3/ fetch the most recent v3.x tag it can find, and go.mod on that tag should have module github.com/buildkite/terminal-to-html/v3?

ticky commented 3 years ago

Doesn't go get github.com/buildkite/terminal-to-html/v3/ fetch the most recent v3.x tag it can find, and go.mod on that tag should have module github.com/buildkite/terminal-to-html/v3?

Yes, but there's now the checksum issue, which I can't work out the root cause of:

› go get github.com/buildkite/terminal-to-html/v3/
go: downloading github.com/buildkite/terminal-to-html/v3 v3.4.0
go get: github.com/buildkite/terminal-to-html/v3@v3.4.0: verifying module: checksum mismatch
    downloaded: h1:tJkY+WxbOUoqrlNda/hzd+OZihFW5GYcfP5ZhFhDdRk=
    sum.golang.org: h1:w+CXTxE0YBTbcfmn+WBXCPn7F4bawYvxT8BI/5r00DY=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
yob commented 3 years ago

Hmm. What directory were you running that go get in @ticky? When I fetch the new 3.5.0 release in a new go project it seems to work ok:

$ go version
go version go1.15.6 linux/amd64

$  export | grep GO
# nothing

$ mkdir foo

$ cd foo/

$ go mod init github.com/yob/foo
go: creating new go.mod: module github.com/yob/foo

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

$ cat go.mod 
module github.com/yob/foo

go 1.15

require github.com/buildkite/terminal-to-html/v3 v3.5.0 // indirect

$ cat go.sum 
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/buildkite/terminal-to-html v1.0.2 h1:C/c6TcIGDM9+rqN08pfWSwzi28KqSdRxlFXcz6qwelc=
github.com/buildkite/terminal-to-html v3.2.0+incompatible h1:WdXzl7ZmYzCAz4pElZosPaUlRTW+qwVx/SkQSCa1jXs=
github.com/buildkite/terminal-to-html/v3 v3.5.0 h1:aBKcU7zYOldn98KfLnCjdjWNQLAP5RZtjTO1zKFK7v0=
github.com/buildkite/terminal-to-html/v3 v3.5.0/go.mod h1:g0ME1XqbkBSgXR9YmlIHcJIjzaMyWW+HbsG0rPb5puo=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
ticky commented 3 years ago

Yeah, 3.5.0 is working