Skip to content

Commit 5b63353

Browse files
committed
feat: use -trimpath to make builds more easily reproducible. Requires go-ipfs >= 0.7.0
1 parent 8abf6da commit 5b63353

File tree

4 files changed

+196
-105
lines changed

4 files changed

+196
-105
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:

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/ipfs/go-ipfs-example-plugin
33
go 1.12
44

55
require (
6-
github.com/ipfs/go-datastore v0.4.4
7-
github.com/ipfs/go-ipfs v0.6.0
6+
github.com/ipfs/go-datastore v0.4.5
7+
github.com/ipfs/go-ipfs v0.7.0-rc2
88
github.com/ipfs/go-ipfs-delay v0.0.1
9-
github.com/ipfs/interface-go-ipfs-core v0.3.0
9+
github.com/ipfs/interface-go-ipfs-core v0.4.0
1010
)

0 commit comments

Comments
 (0)