Skip to content

Commit

Permalink
fix_: generate command
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Sep 30, 2024
1 parent bc949a8 commit 8865560
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,7 @@ setup-dev:
echo "Replaced by Nix shell. Use 'make shell' or just any target as-is."

generate: ##@ Run generate for all given packages using go-generate-fast, fallback to `go generate` (e.g. for docker)
@PACKAGES=$$(go list ./... 2>/dev/null | grep -v "/contracts/"); \
GOROOT=$$(go env GOROOT); \
if which go-generate-fast >/dev/null 2>&1; then \
go-generate-fast $$PACKAGES; \
else \
go generate $$PACKAGES; \
fi
@./_assets/scripts/generate.sh

generate-contracts:
go generate ./contracts
Expand Down Expand Up @@ -394,7 +388,7 @@ canary-test: node-canary
# TODO: uncomment that!
#_assets/scripts/canary_test_mailservers.sh ./config/cli/fleet-eth.prod.json

lint:
lint: generate
golangci-lint run ./...

ci: generate lint canary-test test-unit test-e2e ##@tests Run all linters and tests at once
Expand Down
26 changes: 26 additions & 0 deletions _assets/scripts/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

PACKAGES=$(go list -e ./... | grep -v "/contracts/")
GOROOT=$(go env GOROOT)
export GO_GENERATE_FAST_DISABLE=true
export GO_GENERATE_FAST_DEBUG=true

echo "Running go generate for packages: $PACKAGES"
echo "GOROOT: $GOROOT"

out=$(which go-generate-fast)
go_generate_fast_installed=$?

echo "go-generate-fast installed: $go_generate_fast_installed"
echo "go-generate-fast path: $out"

echo "Running go generate"
go generate -x -skip="abigen" ./...

#if [[ $go_generate_fast_installed -eq 0 ]] ; then
# echo "Running go-generate-fast"
# go-generate-fast -x "${PACKAGES}"
#else
# echo "Running go generate"
# go generate "${PACKAGES}"
#fi

0 comments on commit 8865560

Please sign in to comment.