-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go run supports running an arbitrary go modules like this: go:generate go run golang.org/x/tools/cmd/[email protected] By using that everywhere that our build wanted to demand a previous install of some program, we don't need any of the complexity around `check_deps.sh`, `install_buildtools.sh` and the like. This PR removes them. There shouldn't be a performance problem because the programs will run out of Go's local module cache. Let's see.
- Loading branch information
Showing
22 changed files
with
36 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,7 @@ GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension | |
# e.g. make GOTAGSCUSTOM=msgtrace | ||
GOTAGSLIST += ${GOTAGSCUSTOM} | ||
|
||
# If available, use gotestsum instead of 'go test'. | ||
ifeq (, $(shell which gotestsum)) | ||
export GOTESTCOMMAND=go test | ||
else | ||
export GOTESTCOMMAND=gotestsum --format pkgname --jsonfile testresults.json -- | ||
endif | ||
export GOTESTCOMMAND=go run gotest.tools/[email protected] | ||
|
||
# M1 Mac--homebrew install location in /opt/homebrew | ||
ifeq ($(OS_TYPE), darwin) | ||
|
@@ -99,8 +94,8 @@ fmt: | |
fix: build | ||
$(GOPATH1)/bin/algofix */ | ||
|
||
lint: deps | ||
$(GOPATH1)/bin/golangci-lint run -c .golangci.yml | ||
lint: | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run -c .golangci.yml | ||
|
||
check_go_version: | ||
@if [ $(CURRENT_GO_VERSION_MAJOR) != $(GOLANG_VERSION_BUILD_MAJOR) ]; then \ | ||
|
@@ -127,17 +122,18 @@ cover: | |
prof: | ||
cd node && go test $(GOTAGS) -cpuprofile=cpu.out -memprofile=mem.out -mutexprofile=mutex.out | ||
|
||
generate: deps | ||
generate: | ||
PATH=$(GOPATH1)/bin:$$PATH go generate ./... | ||
|
||
msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE)) | ||
|
||
%/msgp_gen.go: deps ALWAYS | ||
MSGP := go run github.com/algorand/[email protected] | ||
%/msgp_gen.go: ALWAYS | ||
@set +e; \ | ||
printf "msgp: $(@D)..."; \ | ||
$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \ | ||
$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \ | ||
if [ "$$?" != "0" ]; then \ | ||
printf "failed:\n$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \ | ||
printf "failed:\n$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \ | ||
cat ./$@.out; \ | ||
rm ./$@.out; \ | ||
exit 1; \ | ||
|
@@ -157,9 +153,6 @@ crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a: | |
$(MAKE) && \ | ||
$(MAKE) install | ||
|
||
deps: | ||
./scripts/check_deps.sh | ||
|
||
# artifacts | ||
|
||
# Regenerate kmd swagger spec files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
GOPATH := $(shell go env GOPATH) | ||
GOPATH1 := $(firstword $(subst :, ,$(GOPATH))) | ||
|
||
# `make all` or just `make` should be appropriate for dev work | ||
all: server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go server/v2/generated/experimental/routes.go | ||
|
||
# `make generate` should be able to replace old `generate.sh` script and be appropriate for build system use | ||
generate: oapi-codegen all | ||
generate: all | ||
|
||
CODEGEN := go run github.com/algorand/oapi-codegen/cmd/[email protected] | ||
server/v2/generated/nonparticipating/public/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml | ||
|
||
server/v2/generated/nonparticipating/private/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml | ||
|
||
server/v2/generated/participating/public/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml | ||
|
||
server/v2/generated/participating/private/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml | ||
|
||
|
||
server/v2/generated/data/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml | ||
|
||
server/v2/generated/experimental/routes.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml | ||
|
||
server/v2/generated/model/types.go: algod.oas3.yml | ||
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/model/model_types.yml algod.oas3.yml | ||
$(CODEGEN) -config ./server/v2/generated/model/model_types.yml algod.oas3.yml | ||
|
||
algod.oas3.yml: algod.oas2.json | ||
curl -s -X POST "https://converter.swagger.io/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./algod.oas2.json -o .3tmp.json | ||
python3 jsoncanon.py < .3tmp.json > algod.oas3.yml | ||
rm -f .3tmp.json | ||
|
||
oapi-codegen: .PHONY | ||
../../../scripts/buildtools/install_buildtools.sh -o github.com/algorand/oapi-codegen -c github.com/algorand/oapi-codegen/cmd/oapi-codegen | ||
|
||
clean: | ||
rm -rf server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go algod.oas3.yml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,8 @@ | |
// Base path must be a fully specified package name (else, it seems that swagger feeds a relative path to | ||
// loader.Config.Import(), and that breaks the vendor directory if the source is symlinked from elsewhere) | ||
// | ||
//go:generate swagger generate spec -m -o="./swagger.json" | ||
//go:generate swagger validate ./swagger.json --stop-on-error | ||
//go:generate go run github.com/go-swagger/go-swagger/cmd/[email protected] generate spec -m -o="./swagger.json" | ||
//go:generate go run github.com/go-swagger/go-swagger/cmd/[email protected] validate ./swagger.json --stop-on-error | ||
//go:generate sh ../lib/kmdapi/bundle_swagger_json.sh | ||
package api | ||
|
||
|
@@ -70,7 +70,7 @@ import ( | |
|
||
"github.com/gorilla/mux" | ||
|
||
"github.com/algorand/go-algorand/daemon/kmd/api/v1" | ||
v1 "github.com/algorand/go-algorand/daemon/kmd/api/v1" | ||
"github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" | ||
"github.com/algorand/go-algorand/daemon/kmd/session" | ||
"github.com/algorand/go-algorand/logging" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.