Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code generation not require a GOPATH set (mocks, thrift) #4135

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions scripts/auto-gen-helpers.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash

if [ -z "$GOPATH" ]; then
# assume a developer is running locally without a GOPATH
source .ci/variables.sh
else
source "${GOPATH}/src/github.com/m3db/m3/.ci/variables.sh"
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ROOT="${DIR}/.."

source "${ROOT}/.ci/variables.sh"


set -e
Expand Down
4 changes: 2 additions & 2 deletions src/aggregator/aggregator/flush_mgr_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/aggregator/flush_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/aggregator/client/keep_alivable_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/client/queue_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/client/writer_mgr_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/client/writer_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/aggregator/generated/mocks/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
// THE SOFTWARE.

// mockgen rules for generating mocks for exported interfaces (reflection mode).
//go:generate sh -c "mockgen -package=aggregator github.com/m3db/m3/src/aggregator/aggregator Aggregator,ElectionManager,FlushTimesManager,PlacementManager | genclean -pkg github.com/m3db/m3/src/aggregator/aggregator -out $GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/aggregator_mock.go"
//go:generate sh -c "mockgen -package=client github.com/m3db/m3/src/aggregator/client Client,AdminClient | genclean -pkg github.com/m3db/m3/src/aggregator/client -out $GOPATH/src/github.com/m3db/m3/src/aggregator/client/client_mock.go"
//go:generate sh -c "mockgen -package=handler github.com/m3db/m3/src/aggregator/aggregator/handler Handler | genclean -pkg github.com/m3db/m3/src/aggregator/aggregator/handler -out $GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/handler/handler_mock.go"
//go:generate sh -c "mockgen -package=runtime github.com/m3db/m3/src/aggregator/runtime OptionsWatcher | genclean -pkg github.com/m3db/m3/src/aggregator/runtime -out $GOPATH/src/github.com/m3db/m3/src/aggregator/runtime/runtime_mock.go"
//go:generate sh -c "mockgen -package=client net Conn | genclean -pkg github.com/m3db/m3/src/aggregator/client -out $GOPATH/src/github.com/m3db/m3/src/aggregator/client/conn_mock_test.go"
//go:generate sh -c "mockgen -package=aggregator github.com/m3db/m3/src/aggregator/aggregator Aggregator,ElectionManager,FlushTimesManager,PlacementManager | genclean -pkg github.com/m3db/m3/src/aggregator/aggregator -out ../../aggregator/aggregator_mock.go"
//go:generate sh -c "mockgen -package=client github.com/m3db/m3/src/aggregator/client Client,AdminClient | genclean -pkg github.com/m3db/m3/src/aggregator/client -out ../../client/client_mock.go"
//go:generate sh -c "mockgen -package=handler github.com/m3db/m3/src/aggregator/aggregator/handler Handler | genclean -pkg github.com/m3db/m3/src/aggregator/aggregator/handler -out ../../aggregator/handler/handler_mock.go"
//go:generate sh -c "mockgen -package=runtime github.com/m3db/m3/src/aggregator/runtime OptionsWatcher | genclean -pkg github.com/m3db/m3/src/aggregator/runtime -out ../../runtime/runtime_mock.go"
//go:generate sh -c "mockgen -package=client net Conn | genclean -pkg github.com/m3db/m3/src/aggregator/client -out ../../client/conn_mock_test.go"

// mockgen rules for generating mocks for unexported interfaces (file mode).
//go:generate sh -c "mockgen -package=aggregator -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/flush_mgr_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/flush_mgr.go"
//go:generate sh -c "mockgen -package=aggregator -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/flush_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/aggregator/flush.go"
//go:generate sh -c "mockgen -package=client -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/writer_mgr_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/writer_mgr.go"
//go:generate sh -c "mockgen -package=client -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/writer_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/writer.go"
//go:generate sh -c "mockgen -package=client -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/queue_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/queue.go"
//go:generate sh -c "mockgen -package=deploy -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/client_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/client.go"
//go:generate sh -c "mockgen -package=deploy -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/manager_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/manager.go"
//go:generate sh -c "mockgen -package=deploy -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/planner_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/planner.go"
//go:generate sh -c "mockgen -package=deploy -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/validator_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/tools/deploy/validator.go"
//go:generate sh -c "mockgen -package=client -destination=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/keep_alivable_mock_test.go -source=$GOPATH/src/github.com/m3db/m3/src/aggregator/client/conn.go client keepAlivableConn"
//go:generate sh -c "mockgen -package=aggregator -destination=../../aggregator/flush_mgr_mock.go -source=../../aggregator/flush_mgr.go"
//go:generate sh -c "mockgen -package=aggregator -destination=../../aggregator/flush_mock.go -source=../../aggregator/flush.go"
//go:generate sh -c "mockgen -package=client -destination=../../client/writer_mgr_mock.go -source=../../client/writer_mgr.go"
//go:generate sh -c "mockgen -package=client -destination=../../client/writer_mock.go -source=../../client/writer.go"
//go:generate sh -c "mockgen -package=client -destination=../../client/queue_mock.go -source=../../client/queue.go"
//go:generate sh -c "mockgen -package=deploy -destination=../../tools/deploy/client_mock.go -source=../../tools/deploy/client.go"
//go:generate sh -c "mockgen -package=deploy -destination=../../tools/deploy/manager_mock.go -source=../../tools/deploy/manager.go"
//go:generate sh -c "mockgen -package=deploy -destination=../../tools/deploy/planner_mock.go -source=../../tools/deploy/planner.go"
//go:generate sh -c "mockgen -package=deploy -destination=../../tools/deploy/validator_mock.go -source=../../tools/deploy/validator.go"
//go:generate sh -c "mockgen -package=client -destination=../../client/keep_alivable_mock_test.go -source=../../client/conn.go client keepAlivableConn"

package mocks
4 changes: 2 additions & 2 deletions src/aggregator/tools/deploy/client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/tools/deploy/manager_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/tools/deploy/planner_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/aggregator/tools/deploy/validator_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/cluster/generated/mocks/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
// THE SOFTWARE.

// mockgen rules for generating mocks for exported interfaces (reflection mode).
//go:generate sh -c "mockgen -package=client github.com/m3db/m3/src/cluster/client Client | genclean -pkg github.com/m3db/m3/src/cluster/client -out $GOPATH/src/github.com/m3db/m3/src/cluster/client/client_mock.go"
//go:generate sh -c "mockgen -package=client github.com/m3db/m3/src/cluster/client Client | genclean -pkg github.com/m3db/m3/src/cluster/client -out ../../client/client_mock.go"

// mockgen rules for generating mocks for unexported interfaces (file mode).
//go:generate sh -c "mockgen -package=placement -destination=$GOPATH/src/github.com/m3db/m3/src/cluster/placement/placement_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/cluster/placement/types.go"
//go:generate sh -c "mockgen -package=services -destination=$GOPATH/src/github.com/m3db/m3/src/cluster/services/services_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/cluster/services/types.go"
//go:generate sh -c "mockgen -package=kv -destination=$GOPATH/src/github.com/m3db/m3/src/cluster/kv/kv_mock.go -source=$GOPATH/src/github.com/m3db/m3/src/cluster/kv/types.go"
//go:generate sh -c "mockgen -package=placement -destination=../../placement/placement_mock.go -source=../../placement/types.go"
//go:generate sh -c "mockgen -package=services -destination=../../services/services_mock.go -source=../../services/types.go"
//go:generate sh -c "mockgen -package=kv -destination=../../kv/kv_mock.go -source=../../kv/types.go"

package mocks
4 changes: 2 additions & 2 deletions src/cluster/kv/kv_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/cluster/placement/placement_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/cluster/services/services_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/ctl/generated/mocks/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
// THE SOFTWARE.

// mockgen rules for generating mocks using file mode.
//go:generate sh -c "mockgen -package=store $PACKAGE/src/ctl/service/r2/store Store | genclean -pkg $PACKAGE/src/ctl/service/r2/store -out $GOPATH/src/$PACKAGE/src/ctl/service/r2/store/store_mock.go"
//go:generate sh -c "mockgen -package=store $PACKAGE/src/ctl/service/r2/store Store | genclean -pkg $PACKAGE/src/ctl/service/r2/store -out ../../service/r2/store/store_mock.go"

package mocks
2 changes: 1 addition & 1 deletion src/dbnode/client/client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/dbnode/encoding/encoding_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading