Skip to content

Commit 00a93f6

Browse files
committed
Add a script to help with bumping dependencies
1 parent d04885c commit 00a93f6

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module github.com/crunchydata/postgres-operator
22

3+
// If this is changing when you don't want it to, see hack/go-get.sh
34
go 1.22.7
45

56
require (

hack/go-get.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2025 Crunchy Data Solutions, Inc.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
# This runs `$GO get` without changing the "go" directive in the "go.mod" file.
8+
# To change that, pass a "go@go{version}" argument.
9+
#
10+
# https://go.dev/doc/toolchain
11+
#
12+
# Usage: $0 help
13+
# Usage: $0 -u golang.org/x/crypto
14+
# Usage: $0 -u golang.org/x/crypto go@go1.99.0
15+
#
16+
17+
set -eu
18+
: "${GO:=go}"
19+
20+
if [[ "$#" -eq 0 ]] || [[ "$1" == 'help' ]] || [[ "$*" == *'--help'* ]] || [[ "$*" == *'--version'* ]]
21+
then
22+
self=$(command -v -- "$0")
23+
content=$(< "${self}")
24+
content="${content%%$'\n\n'*}"
25+
content="#${content#*$'\n#'}"
26+
content="${content//$'$GO'/${GO}}"
27+
exec echo "${content//$'$0'/$0}"
28+
fi
29+
30+
version=$(${GO} list -m -f 'go@go{{.GoVersion}}')
31+
32+
for arg in "$@"
33+
do case "${arg}" in go@go*) version="${arg}" ;; *) esac
34+
done
35+
36+
${GO} get "$@" "${version}" 'toolchain@none'
37+
${GO} mod tidy

0 commit comments

Comments
 (0)