Remove unnecessary null checks in jq output handling
The jq -r flag with // "" operator already returns empty string for null/missing values, never the literal string "null". The checks for == "null" are unnecessary. Co-authored-by: babakks <36728931+babakks@users.noreply.github.com>
This commit is contained in:
parent
355f507c62
commit
d2cc91bdd4
1 changed files with 0 additions and 7 deletions
7
.github/workflows/scripts/bump-go.sh
vendored
7
.github/workflows/scripts/bump-go.sh
vendored
|
|
@ -52,10 +52,6 @@ GO_MOD_JSON=$(go mod edit -json "$GO_MOD")
|
|||
CURRENT_GO_DIRECTIVE=$(jq -r '.Go // ""' <<< "$GO_MOD_JSON")
|
||||
CURRENT_TOOLCHAIN_DIRECTIVE=$(jq -r '.Toolchain // ""' <<< "$GO_MOD_JSON")
|
||||
|
||||
# Handle empty values from jq
|
||||
[[ "$CURRENT_GO_DIRECTIVE" == "null" || -z "$CURRENT_GO_DIRECTIVE" ]] && CURRENT_GO_DIRECTIVE=""
|
||||
[[ "$CURRENT_TOOLCHAIN_DIRECTIVE" == "null" || -z "$CURRENT_TOOLCHAIN_DIRECTIVE" ]] && CURRENT_TOOLCHAIN_DIRECTIVE=""
|
||||
|
||||
CURRENT_MAJOR_MINOR="$(cut -d. -f1-2 <<< "$CURRENT_GO_DIRECTIVE")"
|
||||
|
||||
BRANCH="bump-go-$TOOLCHAIN_VERSION"
|
||||
|
|
@ -156,9 +152,6 @@ FINAL_GO_MOD_JSON=$(go mod edit -json "$GO_MOD")
|
|||
FINAL_GO_DIRECTIVE=$(jq -r '.Go // ""' <<< "$FINAL_GO_MOD_JSON")
|
||||
FINAL_TOOLCHAIN_DIRECTIVE=$(jq -r '.Toolchain // ""' <<< "$FINAL_GO_MOD_JSON")
|
||||
|
||||
# Handle empty/null values
|
||||
[[ "$FINAL_TOOLCHAIN_DIRECTIVE" == "null" || -z "$FINAL_TOOLCHAIN_DIRECTIVE" ]] && FINAL_TOOLCHAIN_DIRECTIVE=""
|
||||
|
||||
if [[ -n "$FINAL_TOOLCHAIN_DIRECTIVE" ]]; then
|
||||
PR_BODY=$(cat <<EOF
|
||||
This PR updates Go to the latest stable release.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue