Skip to content

Commit dab0e92

Browse files
committed
util.sh: always handle go.sum the same way as go.mod
1 parent 2f84f57 commit dab0e92

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

artifacts/scripts/util.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ EOF
554554
# amend-gomod-at checks out the go.mod at the given commit and amend it to the previous commit.
555555
function amend-gomod-at() {
556556
if [ -f go.mod ]; then
557-
git checkout ${f_mainline_commit} go.mod # reset to mainline state which is guaranteed to be correct
557+
git checkout ${f_mainline_commit} go.mod go.sum # reset to mainline state which is guaranteed to be correct
558558
git commit --amend --no-edit -q
559559
fi
560560
}
@@ -630,9 +630,9 @@ function show-working-dir-status() {
630630

631631
function gomod-changes() {
632632
if [ -n "${2:-}" ]; then
633-
! git diff --exit-code --quiet ${1} ${2} -- go.mod
633+
! git diff --exit-code --quiet ${1} ${2} -- go.mod go.sum
634634
else
635-
! git diff --exit-code --quiet $(state-before-commit ${1}) ${1} -- go.mod
635+
! git diff --exit-code --quiet $(state-before-commit ${1}) ${1} -- go.mod go.sum
636636
fi
637637
}
638638

@@ -735,7 +735,7 @@ function fix-gomod() {
735735
echo "Resolving dependencies for Godeps.json generation"
736736
GOPROXY="file://${GOPATH}/pkg/mod/cache/download" GO111MODULE=on go list -m -json all > /tmp/go-list
737737
/godeps-gen /tmp/go-list Godeps/Godeps.json
738-
git add Godeps go.mod # go.mod is surprisingly written: EOF newline
738+
git add Godeps go.mod go.sum # go.mod is surprisingly written: EOF newline
739739
if ! git-index-clean; then
740740
git commit -q -m "sync: update Godeps/Godeps.json"
741741
fi
@@ -786,11 +786,11 @@ function reset-gomod() {
786786

787787
# checkout or delete go.mod
788788
if [ -n "$(git ls-tree ${f_clean_commit}^{tree} go.mod)" ]; then
789-
git checkout ${f_clean_commit} go.mod
790-
git add go.mod
789+
git checkout ${f_clean_commit} go.mod go.sum
790+
git add go.mod go.sum
791791
elif [ -f go.mod ]; then
792-
rm -f go.mod
793-
git rm -f go.mod
792+
rm -f go.mod go.sum
793+
git rm -f go.mod go.sum
794794
fi
795795

796796
# commit go.mod unconditionally

0 commit comments

Comments
 (0)