# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

# go mod vendor && grep "# g" ./vendor/modules.txt | sort
EGO_PN="github.com/liamg/traitor"
#EGO_VENDOR=(
#	"github.com/sirupsen/logrus v1.4.2"
#)

inherit golang-vcs-snapshot

DESCRIPTION="Automatically exploit low-hanging fruit to pop a root shell"
HOMEPAGE="https://github.com/liamg/traitor"

SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
	${EGO_VENDOR_URI}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm64 x86"

BDEPEND=">=dev-lang/go-1.13"

src_compile() {
	GOPATH="${S}:$(get_golibdir_gopath)" \
		GOCACHE="${T}/go-cache" \
		go build -v -work -x -ldflags="-w" ./... || die
}

src_install(){
	GOPATH="${S}:$(get_golibdir_gopath)" \
		GOCACHE="${T}/go-cache" \
		go install -v -work -x -ldflags="-w" ./... || die

	dobin bin/traitor
}