Skip to content

Commit a9517ed

Browse files
Darioush Jalaliqdm12
authored andcommitted
chore(scripts): update scripts/lint_allowed_eth_imports.sh
See original PR ava-labs/coreth#683
1 parent 0e56432 commit a9517ed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/lint_allowed_eth_imports.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
# Ensure that there are no geth imports that are not marked as explicitly allowed via ./scripts/geth-allowed-packages.txt
8-
# 1. Recursively search through all go files for any lines that include a direct import from go-ethereum
9-
# 2. Ignore lines that import go-ethereum with a named import starting with "geth"
7+
# Ensure that there are no eth imports that are not marked as explicitly allowed via ./scripts/eth-allowed-packages.txt
8+
# 1. Recursively search through all go files for any lines that include a direct import from libevm
9+
# 2. Ignore lines that import libevm with a named import starting with "eth"
1010
# 3. Sort the unique results
11-
# 4. Print out the difference between the search results and the list of specified allowed package imports from geth.
12-
geth_regexp='"github.com/ava-labs/libevm/.*"'
11+
# 4. Print out the difference between the search results and the list of specified allowed package imports from libevm.
12+
libevm_regexp='"github.com/ava-labs/libevm/.*"'
1313
allow_named_imports='eth\w\+ "'
14-
extra_imports=$(grep -r --include='*.go' --exclude=mocks.go --exclude-dir='simulator' "${geth_regexp}" -h | grep -v "${allow_named_imports}" | grep -o "${geth_regexp}" | sort -u | comm -23 - ./scripts/eth-allowed-packages.txt)
14+
extra_imports=$(grep -r --include='*.go' --exclude=mocks.go --exclude-dir='simulator' "${libevm_regexp}" -h | grep -v "${allow_named_imports}" | grep -o "${libevm_regexp}" | sort -u | comm -23 - ./scripts/eth-allowed-packages.txt)
1515
if [ -n "${extra_imports}" ]; then
1616
echo "new ethereum imports should be added to ./scripts/eth-allowed-packages.txt to prevent accidental imports:"
1717
echo "${extra_imports}"

0 commit comments

Comments
 (0)