Files
wehub-resource-sync 6cf6f95f58
CodeQL / Analyze (push) Has been cancelled
Sync to Gitee / Run (push) Has been cancelled
Go / build & test (1.25.x) (push) Has been cancelled
Go / build & test (1.26.x) (push) Has been cancelled
Lint / resolve module (push) Has been cancelled
Lint / lint module (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:43 +08:00

31 lines
647 B
Bash
Executable File

#!/usr/bin/env bash
# This is a common util functions shell script
# arguments: target, item1, item2, item3, ...
# returns 0 if target is in the given items, 1 otherwise.
function util::array_contains() {
local target="$1"
shift
local items="$*"
for item in ${items[*]}; do
if [[ "${item}" == "${target}" ]]; then
return 0
fi
done
return 1
}
# find all go mod path
# returns an array contains mod path
function util::find_modules() {
find . -not \( \
\( \
-path './output' \
-o -path './.git' \
-o -path '*/third_party/*' \
-o -path '*/vendor/*' \
\) -prune \
\) -name 'go.mod' -print0 | xargs -0 -I {} dirname {}
}