https://bugzilla.redhat.com/show_bug.cgi?id=1540726
--- Comment #11 from Robert-André Mauchin zebob.m@gmail.com --- (In reply to Germano Massullo from comment #6)
Done, but I still obtain some errors
main.go:7:2: cannot find package "github.com/evilsocket/bettercap-ng/core" in any of: /usr/lib/golang/src/github.com/evilsocket/bettercap-ng/core (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/ _build/src/github.com/evilsocket/bettercap-ng/core (from $GOPATH) /usr/share/gocode/src/github.com/evilsocket/bettercap-ng/core main.go:8:2: cannot find package "github.com/evilsocket/bettercap-ng/log" in any of: /usr/lib/golang/src/github.com/evilsocket/bettercap-ng/log (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/ _build/src/github.com/evilsocket/bettercap-ng/log (from $GOPATH) /usr/share/gocode/src/github.com/evilsocket/bettercap-ng/log main.go:9:2: cannot find package "github.com/evilsocket/bettercap-ng/modules" in any of: /usr/lib/golang/src/github.com/evilsocket/bettercap-ng/modules (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/ _build/src/github.com/evilsocket/bettercap-ng/modules (from $GOPATH) /usr/share/gocode/src/github.com/evilsocket/bettercap-ng/modules main.go:10:2: cannot find package "github.com/evilsocket/bettercap-ng/session" in any of: /usr/lib/golang/src/github.com/evilsocket/bettercap-ng/session (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/ _build/src/github.com/evilsocket/bettercap-ng/session (from $GOPATH) /usr/share/gocode/src/github.com/evilsocket/bettercap-ng/session
You did not fix the header as I said so it doesn't work:
Your Gopath is probably fcked up. Yes I see, fix your header:
%global provider github %global provider_tld com %global project evilsocket %global repo bettercap-ng %global provider_prefix %{provider}.%{provider_tld}/%{project}
Once you do that you'll see that you are missing plenty of dependencies because you haven't done your job beforehand:
+ go build -buildmode pie -compiler gc -tags=rpm_crashtraceback -ldflags ' -B 0x45265e550377a69ca63e577f452392918e5720c2 -extldflags '''-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '''' -a -v -x -o bettercap . WORK=/tmp/go-build248343626 _build/src/github.com/evilsocket/bettercap-ng/session/command_handler.go:4:2: cannot find package "github.com/chzyer/readline" in any of: /usr/lib/golang/src/github.com/chzyer/readline (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/chzyer/readline (from $GOPATH) /usr/share/gocode/src/github.com/chzyer/readline _build/src/github.com/evilsocket/bettercap-ng/session/prompt.go:10:2: cannot find package "github.com/dustin/go-humanize" in any of: /usr/lib/golang/src/github.com/dustin/go-humanize (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/dustin/go-humanize (from $GOPATH) /usr/share/gocode/src/github.com/dustin/go-humanize _build/src/github.com/evilsocket/bettercap-ng/modules/http_proxy_base.go:24:2: cannot find package "github.com/elazarl/goproxy" in any of: /usr/lib/golang/src/github.com/elazarl/goproxy (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/elazarl/goproxy (from $GOPATH) /usr/share/gocode/src/github.com/elazarl/goproxy _build/src/github.com/evilsocket/bettercap-ng/modules/api_rest.go:14:2: cannot find package "github.com/gin-gonic/gin" in any of: /usr/lib/golang/src/github.com/gin-gonic/gin (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/gin-gonic/gin (from $GOPATH) /usr/share/gocode/src/github.com/gin-gonic/gin _build/src/github.com/evilsocket/bettercap-ng/modules/api_rest_utils.go:8:2: cannot find package "github.com/gin-gonic/gin/binding" in any of: /usr/lib/golang/src/github.com/gin-gonic/gin/binding (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/gin-gonic/gin/binding (from $GOPATH) /usr/share/gocode/src/github.com/gin-gonic/gin/binding _build/src/github.com/evilsocket/bettercap-ng/packets/dhcp6_layer.go:4:2: cannot find package "github.com/google/gopacket" in any of: /usr/lib/golang/src/github.com/google/gopacket (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/google/gopacket (from $GOPATH) /usr/share/gocode/src/github.com/google/gopacket _build/src/github.com/evilsocket/bettercap-ng/packets/arp.go:6:2: cannot find package "github.com/google/gopacket/layers" in any of: /usr/lib/golang/src/github.com/google/gopacket/layers (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/google/gopacket/layers (from $GOPATH) /usr/share/gocode/src/github.com/google/gopacket/layers _build/src/github.com/evilsocket/bettercap-ng/packets/queue.go:13:2: cannot find package "github.com/google/gopacket/pcap" in any of: /usr/lib/golang/src/github.com/google/gopacket/pcap (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/google/gopacket/pcap (from $GOPATH) /usr/share/gocode/src/github.com/google/gopacket/pcap _build/src/github.com/evilsocket/bettercap-ng/modules/net_sniff_context.go:13:2: cannot find package "github.com/google/gopacket/pcapgo" in any of: /usr/lib/golang/src/github.com/google/gopacket/pcapgo (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/google/gopacket/pcapgo (from $GOPATH) /usr/share/gocode/src/github.com/google/gopacket/pcapgo _build/src/github.com/evilsocket/bettercap-ng/modules/http_proxy_base.go:25:2: cannot find package "github.com/inconshreveable/go-vhost" in any of: /usr/lib/golang/src/github.com/inconshreveable/go-vhost (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/inconshreveable/go-vhost (from $GOPATH) /usr/share/gocode/src/github.com/inconshreveable/go-vhost _build/src/github.com/evilsocket/bettercap-ng/modules/arp_spoof.go:13:2: cannot find package "github.com/malfunkt/iprange" in any of: /usr/lib/golang/src/github.com/malfunkt/iprange (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/malfunkt/iprange (from $GOPATH) /usr/share/gocode/src/github.com/malfunkt/iprange _build/src/github.com/evilsocket/bettercap-ng/packets/dhcp6.go:7:2: cannot find package "github.com/mdlayher/dhcp6" in any of: /usr/lib/golang/src/github.com/mdlayher/dhcp6 (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/mdlayher/dhcp6 (from $GOPATH) /usr/share/gocode/src/github.com/mdlayher/dhcp6 _build/src/github.com/evilsocket/bettercap-ng/modules/dhcp6_spoof.go:23:2: cannot find package "github.com/mdlayher/dhcp6/dhcp6opts" in any of: /usr/lib/golang/src/github.com/mdlayher/dhcp6/dhcp6opts (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/mdlayher/dhcp6/dhcp6opts (from $GOPATH) /usr/share/gocode/src/github.com/mdlayher/dhcp6/dhcp6opts _build/src/github.com/evilsocket/bettercap-ng/modules/net_recon_show.go:14:2: cannot find package "github.com/olekukonko/tablewriter" in any of: /usr/lib/golang/src/github.com/olekukonko/tablewriter (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/olekukonko/tablewriter (from $GOPATH) /usr/share/gocode/src/github.com/olekukonko/tablewriter _build/src/github.com/evilsocket/bettercap-ng/modules/http_proxy_script.go:11:2: cannot find package "github.com/robertkrimen/otto" in any of: /usr/lib/golang/src/github.com/robertkrimen/otto (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/github.com/robertkrimen/otto (from $GOPATH) /usr/share/gocode/src/github.com/robertkrimen/otto _build/src/github.com/evilsocket/bettercap-ng/modules/api_rest_security.go:10:2: cannot find package "gopkg.in/unrolled/secure.v1" in any of: /usr/lib/golang/src/gopkg.in/unrolled/secure.v1 (from $GOROOT)
/builddir/build/BUILD/bettercap-ng-eb1a53efa3171aefed0ec9766d8c5047bd0df289/_build/src/gopkg.in/unrolled/secure.v1 (from $GOPATH) /usr/share/gocode/src/gopkg.in/unrolled/secure.v1
Run the app through Gofed to get a list of the dependencies:
# gofed repo2spec --detect https://github.com/evilsocket/bettercap-ng
You'll get in the SPEC:
BuildRequires: golang(github.com/chzyer/readline) BuildRequires: golang(github.com/dustin/go-humanize) BuildRequires: golang(github.com/elazarl/goproxy) BuildRequires: golang(github.com/gin-gonic/gin) BuildRequires: golang(github.com/gin-gonic/gin/binding) BuildRequires: golang(github.com/google/gopacket) BuildRequires: golang(github.com/google/gopacket/layers) BuildRequires: golang(github.com/google/gopacket/pcap) BuildRequires: golang(github.com/google/gopacket/pcapgo) BuildRequires: golang(github.com/inconshreveable/go-vhost) BuildRequires: golang(github.com/malfunkt/iprange) BuildRequires: golang(github.com/mdlayher/dhcp6) BuildRequires: golang(github.com/mdlayher/dhcp6/dhcp6opts) BuildRequires: golang(github.com/olekukonko/tablewriter) BuildRequires: golang(github.com/robertkrimen/otto)
Add them to your SPEC.
Now look what packages are already in Fedora and package those which are not. Look on Pagure (https://src.fedoraproject.org/), Gofed use the outdated Pkgdb so it's not reliable.
Package these missing libraries using Gofed. By default, it tries to do a snapshot of the GIT repo, you need to check if upstream has not actually tagged a release. If they did, use that release instead of the snapshot. If not keep the snapshot but add the commit date to the Release: tag (See https://fedoraproject.org/wiki/Packaging:Versioning#Snapshots).