pierrec / lz4

LZ4 compression and decompression in pure Go
BSD 3-Clause "New" or "Revised" License
878 stars 142 forks source link

go install: [...]: module [...]@latest found, but does not contain package ...v4/cmd/lz4c #174

Open cedricvanrompay opened 2 years ago

cedricvanrompay commented 2 years ago

Trying to follow the installation instructions from the README:

$ go install github.com/pierrec/lz4/v4/cmd/lz4c
go install: version is required when current directory is not in a module
    Try 'go install github.com/pierrec/lz4/v4/cmd/lz4c@latest' to install the latest version
$ go install github.com/pierrec/lz4/v4/cmd/lz4c@latest
go: downloading github.com/pierrec/lz4/v4 v4.1.14
go: downloading github.com/pierrec/lz4 v2.6.1+incompatible
go install: github.com/pierrec/lz4/v4/cmd/lz4c@latest: module github.com/pierrec/lz4/v4@latest found (v4.1.14), but does not contain package github.com/pierrec/lz4/v4/cmd/lz4c

I tried several things read on the Web like go clean -modcache but this does not help

pierrec commented 2 years ago

Thanks for reporting this. It looks like it is broken. WIll investigate.

wkhere commented 2 years ago

Hello, @pierrec. I was also hit by this error. Just a hint here, I believe there is no need to have another module in ./cmd/lz4c. I think the common practice is to just have single per-project module, and still the commands under ./cmd/... are installable this wat via go install github.com/user/project/vN/cmd/xxxx@latest

wkhere commented 1 year ago

Hey @pierrec . Again confirming as above: no need to have go.mod and go.sum in the cmd/lz4c directory. It's enough to delete them to get this issue fixed.

As a proof, please install my fork:

go install github.com/wkhere/lz4/cmd/lz4c@latest

which is your project with just go.mod/sum deleted from cmd/lz4c and the module name changed to reflect my github path in the toplevel go.mod.

corneliusroemer commented 10 months ago

I can confirm @wkhere's install command works in contrast to the one in the readme