Skip to content

Commit

Permalink
feat: use -trimpath to make builds more easily reproducible. Requires…
Browse files Browse the repository at this point in the history
… go-ipfs >= 0.7.0
  • Loading branch information
aschmahmann committed Sep 22, 2020
1 parent 8abf6da commit 5b63353
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 105 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ GO111MODULE = on
GOCC ?= go
GOFLAGS ?=

# make reproducable
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"

# If set, override the install location for plugins
IPFS_PATH ?= $(HOME)/.ipfs

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

# make reproducible
ifneq ($(findstring /,$(IPFS_VERSION)),)
# Locally built go-ipfs
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
else
# Remote version of go-ipfs (e.g. via `go get -trimpath` or official distribution)
GOFLAGS += -trimpath
endif

.PHONY: install build

go.mod: FORCE
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ You can set `IPFS_VERSION` to:

* `vX.Y.Z` to build against that version of IPFS.
* `$commit` or `$branch` to build against a specific go-ipfs commit or branch.
* 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`
* `/absolute/path/to/source` to build against a specific go-ipfs checkout.

To update the go-ipfs, run:
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/ipfs/go-ipfs-example-plugin
go 1.12

require (
github.com/ipfs/go-datastore v0.4.4
github.com/ipfs/go-ipfs v0.6.0
github.com/ipfs/go-datastore v0.4.5
github.com/ipfs/go-ipfs v0.7.0-rc2
github.com/ipfs/go-ipfs-delay v0.0.1
github.com/ipfs/interface-go-ipfs-core v0.3.0
github.com/ipfs/interface-go-ipfs-core v0.4.0
)
Loading

0 comments on commit 5b63353

Please sign in to comment.