gearnode / privatebin

A powerful CLI for creating and managing PrivateBin pastes with ease
ISC License
53 stars 4 forks source link

Build on Windows? #6

Closed elpatron68 closed 6 months ago

elpatron68 commented 9 months ago

Hi,

this Privatebin CLI is exactly what I was looking for, thanks! Is it possible to build a Windows binary? As far as I can see, the Makefile is made for Linux only?

I tried

GOOS=windows GOARCH=amd64 go build -ldflags "-X 'gearno.de/privatebin/internal/version.Version=1.4.0'" -o bin/privatebin.exe cmd/privatebin/main.go

But it fails with

~/privatebin$ GOOS=windows GOARCH=amd64 go build -ldflags "-X 'gearno.de/privatebin/internal/version.Version=1.4.0'" -o bin/privatebin.exe cmd/privatebin/main.go
cmd/privatebin/main.go:29:2: cannot find package "gearno.de/privatebin" in any of:
        /usr/lib/go-1.10/src/gearno.de/privatebin (from $GOROOT)
        /home/markus/go/src/gearno.de/privatebin (from $GOPATH)
cmd/privatebin/main.go:30:2: cannot find package "gearno.de/privatebin/internal/version" in any of:
        /usr/lib/go-1.10/src/gearno.de/privatebin/internal/version (from $GOROOT)
        /home/markus/go/src/gearno.de/privatebin/internal/version (from $GOPATH)

Update:

Probably there is a problem with an outdated certificate when trying to download a dependency?

go get gearno.de/privatebin/internal/version
package gearno.de/privatebin/internal/version: unrecognized import path "gearno.de/privatebin/internal/version" (https fetch: Get https://gearno.de/privatebin/internal/version?go-get=1: x509: certificate has expired or is not yet valid)

Regards, Markus

MetaSeb commented 9 months ago

Hello,

Go to the \cmd\privatebin sub-directory

Run the command:

go build -o privatebin_1.4.exe main.go

Then you can run the program:

privatebin_1.4.exe --help

The output is


  -attachment
        create the paste as an attachment
  -bin string
        the privatebin name to use
  -burn-after-reading
        delete the paste after reading
  -cfg-file string
        the path of the configuration file (default "~/.config/privatebin/config.json")
  -expire string
        the time to live of the paste
  -filename string
        read filepath instead of stdin
  -formatter string
        the text formatter to use, can be plaintext, markdown or syntaxhighlighting
  -gzip
        gzip the paste data (default true)
  -help
        shows this help message
  -open-discussion
        enable discussion on the paste
  -password string
        the paste password
  -version
        prints the privatebin cli version```
elpatron68 commented 9 months ago

Hi @MetaSeb , thanks a lot and sorry for my lack of knowledge!

gearnode commented 6 months ago

Since 2.x series, you can directly download the prebuilt binary.