mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-18 10:06:51 +01:00
mod+tools+Makefile: use go install to fetch dependencies
Instead of hard coding a commit to use for a binary tool that we use during the build process, we now only use "go install" to install the binaries and the golang builtin versioning system to pin the exact version/commit we want to use in go.mod.
This commit is contained in:
43
Makefile
43
Makefile
@@ -27,23 +27,12 @@ ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Lndmobile.aar
|
||||
COMMIT := $(shell git describe --tags --dirty)
|
||||
COMMIT_HASH := $(shell git rev-parse HEAD)
|
||||
|
||||
BTCD_COMMIT := $(shell cat go.mod | \
|
||||
grep $(BTCD_PKG) | \
|
||||
head -n1 | \
|
||||
awk -F " " '{ print $$2 }' | \
|
||||
awk -F "/" '{ print $$1 }')
|
||||
|
||||
LINT_COMMIT := v1.18.0
|
||||
GOACC_COMMIT :=80342ae2e0fcf265e99e76bcc4efd022c7c3811b
|
||||
GOFUZZ_COMMIT := b1f3d6f
|
||||
|
||||
DEPGET := cd /tmp && GO111MODULE=on go get -v
|
||||
GOBUILD := GO111MODULE=on go build -v
|
||||
GOINSTALL := GO111MODULE=on go install -v
|
||||
GOTEST := GO111MODULE=on go test
|
||||
|
||||
GOVERSION := $(shell go version | awk '{print $$3}')
|
||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go")
|
||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")
|
||||
|
||||
RM := rm -f
|
||||
CP := cp
|
||||
@@ -80,8 +69,6 @@ endif
|
||||
|
||||
LINT = $(LINT_BIN) run -v $(LINT_WORKERS)
|
||||
|
||||
GOFUZZ_DEP_PKG_FETCH = go get -v $(GOFUZZ_DEP_PKG)@$(GOFUZZ_COMMIT)
|
||||
|
||||
GREEN := "\\033[0;32m"
|
||||
NC := "\\033[0m"
|
||||
define print
|
||||
@@ -96,28 +83,32 @@ all: scratch check install
|
||||
# DEPENDENCIES
|
||||
# ============
|
||||
$(LINT_BIN):
|
||||
@$(call print, "Fetching linter")
|
||||
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
|
||||
@$(call print, "Installing linter.")
|
||||
go install $(LINT_PKG)
|
||||
|
||||
$(GOACC_BIN):
|
||||
@$(call print, "Fetching go-acc")
|
||||
$(DEPGET) $(GOACC_PKG)@$(GOACC_COMMIT)
|
||||
@$(call print, "Installing go-acc.")
|
||||
go install $(GOACC_PKG)
|
||||
|
||||
btcd:
|
||||
@$(call print, "Installing btcd.")
|
||||
$(DEPGET) $(BTCD_PKG)@$(BTCD_COMMIT)
|
||||
go install $(BTCD_PKG)
|
||||
|
||||
goimports:
|
||||
@$(call print, "Installing goimports.")
|
||||
$(DEPGET) $(GOIMPORTS_PKG)
|
||||
go install $(GOIMPORTS_PKG)
|
||||
|
||||
$(GOFUZZ_BIN):
|
||||
@$(call print, "Fetching go-fuzz")
|
||||
$(DEPGET) $(GOFUZZ_PKG)@$(GOFUZZ_COMMIT)
|
||||
@$(call print, "Installing go-fuzz.")
|
||||
go install $(GOFUZZ_PKG)
|
||||
|
||||
$(GOFUZZ_BUILD_BIN):
|
||||
@$(call print, "Fetching go-fuzz-build")
|
||||
$(DEPGET) $(GOFUZZ_BUILD_PKG)@$(GOFUZZ_COMMIT)
|
||||
@$(call print, "Installing go-fuzz-build.")
|
||||
go install $(GOFUZZ_BUILD_PKG)
|
||||
|
||||
$(GOFUZZ_DEP_BIN):
|
||||
@$(call print, "Installing go-fuzz-dep.")
|
||||
go install $(GOFUZZ_DEP_PKG)
|
||||
|
||||
# ============
|
||||
# INSTALLATION
|
||||
@@ -243,9 +234,7 @@ flakehunter-parallel:
|
||||
# =============
|
||||
# FUZZING
|
||||
# =============
|
||||
fuzz-build: $(GOFUZZ_BUILD_BIN)
|
||||
@$(call print, "Fetching go-fuzz-dep package")
|
||||
$(GOFUZZ_DEP_PKG_FETCH)
|
||||
fuzz-build: $(GOFUZZ_BUILD_BIN) $(GOFUZZ_DEP_BIN)
|
||||
@$(call print, "Creating fuzz harnesses for packages '$(FUZZPKG)'.")
|
||||
scripts/fuzz.sh build "$(FUZZPKG)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user