Skip to content

Commit

Permalink
Rework regex matching for lint_allowed_geth_imports.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Feb 17, 2025
1 parent a4eaf83 commit e389c7f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion scripts/geth-allowed-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick"
"github.com/ethereum/go-ethereum/rlp"
2 changes: 1 addition & 1 deletion scripts/lint_allowed_geth_imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o pipefail
# 1. Recursively search through all go files for any lines that include a direct import from go-ethereum
# 2. Sort the unique results
# #. Print out the difference between the search results and the list of specified allowed package imports from geth.
extra_imports=$(grep -r --include='*.go' --exclude-dir='simulator' '"github.com/ethereum/go-ethereum/.*"' -o -h | sort -u | comm -23 - ./scripts/geth-allowed-packages.txt)
extra_imports=$(grep -r --include='*.go' --exclude-dir='simulator' -E '"github.com/ethereum/go-ethereum/[a-z0-9_/]+"' -o -h | sort -u | comm -23 - ./scripts/geth-allowed-packages.txt)
if [ -n "${extra_imports}" ]; then
echo "new go-ethereum imports should be added to ./scripts/geth-allowed-packages.txt to prevent accidental imports:"
echo "${extra_imports}"
Expand Down

0 comments on commit e389c7f

Please sign in to comment.