Skip to content

Commit

Permalink
build(golang): Support faster local iteration and align better with u…
Browse files Browse the repository at this point in the history
…pstream

* Replace synthetic "go-mod-cache" Makefile target with direct dependence
  upon go.sum.
* Introduce support for `make SKIP_MOD_VERIFY=1` to avoid unnecessary
  expensive scans when e.g. tweaking referents of local-directory
  `replace $modulePath => ../path/to/module` directives in go.mod.
  • Loading branch information
gibson042 committed Aug 29, 2024
1 parent 88fe8c9 commit 987f340
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions golang/cosmos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ node-compile-gyp:
npm run build:gyp; \
fi

compile-agd: go-mod-cache
compile-agd: go.sum
go build -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=exe -o build/agd ./cmd/agd

install-agd: go-mod-cache
install-agd: go.sum
go install -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=exe ./cmd/agd

# Only run from the package.json build:gyp script.
Expand All @@ -73,17 +73,18 @@ compile-gyp:
node-gyp configure build $(GYP_DEBUG) || { status=$$?; rm -f binding.gyp; exit $$status; }
rm -f binding.gyp

compile-libdaemon: go-mod-cache
compile-libdaemon: go.sum
go build -v $(MOD_READONLY) $(SHARED_BUILD_FLAGS) -buildmode=c-shared \
-o build/libagcosmosdaemon.so ./cmd/libdaemon/main.go

go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@go mod download

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@echo "--> Ensure dependencies have not been modified unless suppressed by SKIP_MOD_VERIFY ..."
ifndef SKIP_MOD_VERIFY
GO111MODULE=on go mod verify
endif
GO111MODULE=on go mod tidy
@echo "--> Download go modules to local cache"
go mod download

###############################################################################
### Protobuf ###
Expand Down

0 comments on commit 987f340

Please sign in to comment.