github.com/prysmaticlabs/prysm@v1.4.4/scripts/update-mockgen.sh (about) 1 #!/bin/bash 2 3 # Script to update mock files after proto/beacon/rpc/v1/services.proto changes. 4 # Use a space to separate mock destination from its interfaces. 5 6 mock_path="shared/mock" 7 mocks=( 8 "$mock_path/beacon_service_mock.go BeaconChainClient,BeaconChain_StreamChainHeadClient,BeaconChain_StreamAttestationsClient,BeaconChain_StreamBlocksClient,BeaconChain_StreamValidatorsInfoClient,BeaconChain_StreamIndexedAttestationsClient" 9 "$mock_path/beacon_chain_service_mock.go BeaconChain_StreamChainHeadServer,BeaconChain_StreamAttestationsServer,BeaconChain_StreamBlocksServer,BeaconChain_StreamValidatorsInfoServer,BeaconChain_StreamIndexedAttestationsServer" 10 "$mock_path/beacon_validator_server_mock.go BeaconNodeValidatorServer,BeaconNodeValidator_WaitForActivationServer,BeaconNodeValidator_WaitForChainStartServer,BeaconNodeValidator_StreamDutiesServer" 11 "$mock_path/beacon_validator_client_mock.go BeaconNodeValidatorClient,BeaconNodeValidator_WaitForChainStartClient,BeaconNodeValidator_WaitForActivationClient,BeaconNodeValidator_StreamDutiesClient" 12 "$mock_path/event_service_mock.go EventsClient,Events_StreamEventsClient,Events_StreamEventsServer" 13 "$mock_path/node_service_mock.go NodeClient" 14 "$mock_path/keymanager_mock.go RemoteSignerClient" 15 ) 16 17 for ((i = 0; i < ${#mocks[@]}; i++)); do 18 file=${mocks[i]% *}; 19 interfaces=${mocks[i]#* }; 20 echo "generating $file for interfaces: $interfaces"; 21 GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/proto/eth/v1alpha1 "$interfaces" 22 GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/proto/validator/accounts/v2 "$interfaces" 23 done 24 25 goimports -w "$mock_path/." 26 gofmt -s -w "$mock_path/."