doronbehar / pistol

General purpose file previewer designed for Ranger, Lf to make scope.sh redundant
MIT License
312 stars 7 forks source link

go install github.com/doronbehar/pistol@latest doesn't fetch the latest version? #112

Open salenius opened 2 months ago

salenius commented 2 months ago

I can't install pistol on my Linux Mint computer. It has the following specs:

`Operating System: Linux Mint 21.3

Kernel: Linux 5.15.0-113-generic

Architecture: x86-64

Hardware Vendor: Apple Inc.

Hardware Model: iMac16,2

I have Golang and libmagic installed.

> go version go version go1.22.5 linux/amd64

> whereis libmagic libmagic: /usr/share/man/man3/libmagic.3.gz

Then when I'm trying to use command go install github.com/doronbehar/pistol/cmd/pistol@latest I get the following output

# github.com/doronbehar/pistol/internal_writers go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:33:22: undefined: archiver.NewZip go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:36:22: undefined: archiver.NewRar go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:39:22: undefined: archiver.NewTar go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:44:23: undefined: archiver.NewTarXz go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:50:23: undefined: archiver.NewTarBz2 go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:56:23: undefined: archiver.NewTarGz go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:62:23: undefined: archiver.NewTarLz4 go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:68:23: undefined: archiver.NewTarSz go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:73:23: undefined: archiver.NewTarZstd go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:85:34: undefined: archiver.Walker go/pkg/mod/github.com/doronbehar/pistol@v0.4.4/internal_writers/archives.go:85:34: too many errors

Any ideas is there something that I'm missing?

doronbehar commented 2 months ago

Linux on a Mac hardware? Nice. Do you have the magic.h header installed there? Try the file-devel package:

https://packages.fedoraproject.org/pkgs/file/file-devel/

salenius commented 2 months ago

Thanks for the quick answer! Yeah, had this setup for just about a month now. :) I checked, I checked that I have the following files using your link as a reference:

usr/include/magic.h lib/x86_64-linux-gnu/libmagic.so lib/x86_64-linux-gnu/pkgconfig/libmagic.pc

file-devel doesn't seem to exist in repositories apt uses. Fedora version you linked is probably not the right one for my distro.

doronbehar commented 2 months ago

Does setting the following helps?

CGO_LDFLAGS="-L/lib/x86_64-linux-gnu"

Before running go install github.com/doronbehar/pistol/cmd/pistol@latest.

salenius commented 2 months ago

I added that to my .profile. Unfortunately it doesn't help even after I rebooted my computer.

doronbehar commented 2 months ago

What happens when you git clone the repository, and run make, or go build?

salenius commented 2 months ago

I got it set up using cloning and then using ´make´ and it worked! Although pistol is not currently rendering the images in my terminal, but just showing textual information about the image. This latter thing is probably it's whole separate issue though.

EDIT: It seems you don't support image preview with rendering, so I guess this issue can be closed down. Thanks for the help!

PS. Great avatar, Snufkin is my favorite Moomin character :)

doronbehar commented 2 months ago

Great I'm glad you have pistol working for you now. I won't close this issue as I think there is an issue with go install github.com/doronbehar/pistol/cmd/pistol@latest. I tried to reproduce this issue with:

env GOPATH=/tmp/go go install github.com/doronbehar/pistol/cmd/pistol@latest

And I encountered a different error:

go: downloading github.com/doronbehar/pistol v0.4.4
go: downloading github.com/doronbehar/magicmime v0.1.1-0.20211127135329-3de4ff29dc49
go: downloading github.com/adrg/xdg v0.4.0
go: downloading github.com/alexflint/go-arg v1.5.0
go: downloading github.com/alessio/shellescape v1.4.2
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/alecthomas/chroma/v2 v2.14.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/mholt/archiver/v4 v4.0.0-alpha.8
go: downloading github.com/nwaples/rardecode v1.1.3
go: downloading golang.org/x/sys v0.21.0
go: downloading github.com/alexflint/go-scalar v1.2.0
go: downloading github.com/dlclark/regexp2 v1.11.0
go: downloading github.com/klauspost/compress v1.17.9
go: downloading github.com/golang/snappy v0.0.4
go: downloading github.com/bodgit/sevenzip v1.3.0
go: downloading github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5
go: downloading github.com/andybalholm/brotli v1.1.0
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/nwaples/rardecode/v2 v2.0.0-beta.2
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading golang.org/x/text v0.3.8
go: downloading github.com/bodgit/plumbing v1.2.0
go: downloading github.com/bodgit/windows v1.0.0
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading go4.org v0.0.0-20200411211856-f5505b9728dd
go: downloading github.com/connesc/cipherio v0.2.1
go: downloading github.com/hashicorp/errwrap v1.0.0
github.com/doronbehar/magicmime: build constraints exclude all Go files in /tmp/pkg/mod/github.com/doronbehar/magicmime@v0.1.1-0.20211127135329-3de4ff29dc49

What worries me is that @latest doesn't fetch v0.5, but v0.4.4 - I'm pretty sure that is related to the issue - there were a few changes in the API of the libraries between 0.4.4 and 0.5 that are related to the errors you experienced.

I just bumped a new version (0.5.2) - perhaps that will be detected as @latest in a few hours.

What ever you'll decide to do, you can always fetch a static build of pistol (along with a manpage) via the release's assets:

https://github.com/doronbehar/pistol/releases