Skip to content

Commit 426ea45

Browse files
committed
feat: use -trimpath to make builds more easily reproducible. Requires go-ipfs >= 0.7.0
1 parent 1c029f6 commit 426ea45

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ GO111MODULE = on
44
GOCC ?= go
55
GOFLAGS ?=
66

7-
# make reproducable
8-
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
9-
107
# If set, override the install location for plugins
118
IPFS_PATH ?= $(HOME)/.ipfs
129

1310
# If set, override the IPFS version to build against. This _modifies_ the local
1411
# go.mod/go.sum files and permanently sets this version.
1512
IPFS_VERSION ?= $(lastword $(shell $(GOCC) list -m github.com/ipfs/go-ipfs))
1613

14+
# make reproducible
15+
ifneq ($(findstring /,$(IPFS_VERSION)),)
16+
# Locally built go-ipfs
17+
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
18+
else
19+
# Remote version of go-ipfs (e.g. via `go get -trimpath` or official distribution)
20+
GOFLAGS += -trimpath
21+
endif
22+
1723
.PHONY: install build
1824

1925
go.mod: FORCE

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ You can set `IPFS_VERSION` to:
2929

3030
* `vX.Y.Z` to build against that version of IPFS.
3131
* `$commit` or `$branch` to build against a specific go-ipfs commit or branch.
32+
* Note: if building against a commit or branch make sure to build that commit/branch using the -trimpath flag. For example getting the binary via `go get -trimpath github.com/ipfs/go-ipfs/cmd/ipfs@COMMIT`
3233
* `/absolute/path/to/source` to build against a specific go-ipfs checkout.
3334

3435
To update the go-ipfs, run:

0 commit comments

Comments
 (0)