cointop-sh / cointop

A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
https://cointop.sh
Apache License 2.0
3.98k stars 311 forks source link

undefined: time.UnixMilli when updating #260

Closed zogith closed 2 years ago

zogith commented 2 years ago

Xubuntu 20.04 with golang-go:amd64/focal 2:1.13~1ubuntu2 uptodate installed

updating the installed compiled binary (or trying to install fresh) fails with this error, on 2 different PCs for me:

go get -u github.com/cointop-sh/cointop
# github.com/cointop-sh/cointop/pkg/timedata
go/src/github.com/cointop-sh/cointop/pkg/timedata/timedata.go:43:14: undefined: time.UnixMilli
go/src/github.com/cointop-sh/cointop/pkg/timedata/timedata.go:44:14: undefined: time.UnixMilli
go/src/github.com/cointop-sh/cointop/pkg/timedata/timedata.go:52:13: undefined: time.UnixMilli
go/src/github.com/cointop-sh/cointop/pkg/timedata/timedata.go:53:13: undefined: time.UnixMilli
go/src/github.com/cointop-sh/cointop/pkg/timedata/timedata.go:68:16: undefined: time.UnixMilli
lyricnz commented 2 years ago

Looks like this was added in golang 1.17 https://pkg.go.dev/time#UnixMilli

Which version are you running? (run go version)

lyricnz commented 2 years ago

@miguelmota what's cointop minimum golang version? Would be simple enough to use a utility function for this if <1.17

func UnixMilli(msec int64) Time {
    return Unix(msec/1e3, (msec%1e3)*1e6)
}
zogith commented 2 years ago

Looks like this was added in golang 1.17 https://pkg.go.dev/time#UnixMilli

Which version are you running? (run go version)

go version
go version go1.13.8 linux/amd64
lyricnz commented 2 years ago

The current code needs go 1.17. If you don't want to build it yourself, maybe you could just use the pre-built binary?

https://github.com/cointop-sh/cointop/releases/download/v1.6.9/cointop_1.6.9_linux_amd64.tar.gz

zogith commented 2 years ago

On Xubuntu 20.04 (and presumably any other Ubuntu variant on the current LTS release) the prebuilt binary gives:

./cointop: /lib/x86_64-linux-gnu/libc.so.6: versionGLIBC_2.32' not found (required by ./cointop)`

but installing go 1.17 on the box could be an acceptable solution.

zogith commented 2 years ago

I have installed go 1.17 using the Ubuntu "snap" package (not my first choice but I prefer this over installing from source) using the command described in https://linuxhint.com/install-go-ubuntu-2/ and then

go install  github.com/cointop-sh/cointop@v1.6.9

worked for me, I now have a shiny new working cointop, thanks.

lyricnz commented 2 years ago

101 is about the glibc dep. I don't have such a box, or idea how to build such a binary in CI.

zogith commented 2 years ago

https://docs.cointop.sh/install/ mentions go 1.12 as the minimum, and references an install command syntax that will not work with go 1.17

lyricnz commented 2 years ago

patches welcome!

lyricnz commented 2 years ago

It wouldn't be too hard to use a utility version, rather than the golang 1.17 version, of UnixMilli. But only worthwhile if the project wants to support older golang, which is not my call.

miguelmota commented 2 years ago

@lyricnz I'm in favor of using the latest stable version of Go. I would recommend installing cointop from a package manager or using a pre-compiled binary that is available for systems where Go is not up-to-date or available.

lyricnz commented 2 years ago

Merged PR #301