refactor: reorganize modules and add Linux build tooling
This commit is contained in:
45
scripts/update-all.sh
Executable file
45
scripts/update-all.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly WORKSPACE_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
|
||||
|
||||
if ! command -v go >/dev/null 2>&1; then
|
||||
echo "error: Go is not installed or is not available in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${WORKSPACE_ROOT}"
|
||||
|
||||
if [[ ! -f go.work ]]; then
|
||||
echo "error: go.work was not found in ${WORKSPACE_ROOT}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mapfile -t modules < <(go list -m -f '{{.Dir}}')
|
||||
if (( ${#modules[@]} == 0 )); then
|
||||
echo "error: no workspace modules were found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updating dependencies for ${#modules[@]} workspace modules..."
|
||||
|
||||
for module_dir in "${modules[@]}"; do
|
||||
module_name="$(cd -- "${module_dir}" && go list -m -f '{{.Path}}')"
|
||||
echo
|
||||
echo "==> ${module_name} (${module_dir})"
|
||||
|
||||
(
|
||||
cd -- "${module_dir}"
|
||||
go get -u ./...
|
||||
go mod tidy
|
||||
)
|
||||
done
|
||||
|
||||
echo
|
||||
echo "==> Synchronizing go.work"
|
||||
go work sync
|
||||
|
||||
echo
|
||||
echo "Dependency update completed successfully. Review and test the changes before committing."
|
||||
Reference in New Issue
Block a user