|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | # Function to run sed in-place with OS-specific options |
4 | | -sed_inplace() { |
| 4 | +sed_replace() { |
5 | 5 | if [[ "$OSTYPE" == "darwin"* ]]; then |
6 | 6 | # macOS - requires empty string after -i |
7 | 7 | sed -i '' "$@" |
|
40 | 40 |
|
41 | 41 | if [[ true ]]; then |
42 | 42 | # Use sed to replace the version number in version.go |
43 | | - sed_inplace 's/VERSION = ".*"/VERSION = "'${newVersion}'"/' version.go |
| 43 | + sed_replace 's/VERSION = ".*"/VERSION = "'${newVersion}'"/' version.go |
44 | 44 |
|
45 | 45 | # Use sed to replace the version number in README.MD |
46 | | - sed_inplace 's/version=[^"]*/version='${newVersion}'/' README.MD |
47 | | - sed_inplace 's/version=[^"]*/version='${newVersion}'/' README.zh_CN.MD |
| 46 | + sed_replace 's/version=[^"]*/version='${newVersion}'/' README.MD |
| 47 | + sed_replace 's/version=[^"]*/version='${newVersion}'/' README.zh_CN.MD |
48 | 48 | fi |
49 | 49 |
|
50 | 50 | if [ -f "go.work" ]; then |
@@ -81,20 +81,20 @@ for file in `find ${workdir} -name go.mod`; do |
81 | 81 | go mod edit -replace github.com/gogf/gf/contrib/drivers/sqlite/v2=../../contrib/drivers/sqlite |
82 | 82 | fi |
83 | 83 | # Remove indirect dependencies |
84 | | - sed_inplace '/\/\/ indirect/d' go.mod |
| 84 | + sed_replace '/\/\/ indirect/d' go.mod |
85 | 85 | go mod tidy |
86 | 86 | # Remove toolchain line if exists |
87 | | - sed_inplace '/^toolchain/d' go.mod |
| 87 | + sed_replace '/^toolchain/d' go.mod |
88 | 88 |
|
89 | 89 | # Upgrading only GoFrame related libraries, sometimes even if a version number is specified, |
90 | 90 | # it may not be possible to successfully upgrade. Please confirm before submitting the code |
91 | 91 | go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" |
92 | 92 | go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" | xargs -L1 go get -v |
93 | 93 | # Remove indirect dependencies |
94 | | - sed_inplace '/\/\/ indirect/d' go.mod |
| 94 | + sed_replace '/\/\/ indirect/d' go.mod |
95 | 95 | go mod tidy |
96 | 96 | # Remove toolchain line if exists |
97 | | - sed_inplace '/^toolchain/d' go.mod |
| 97 | + sed_replace '/^toolchain/d' go.mod |
98 | 98 | if [ $goModPath = "./cmd/gf" ]; then |
99 | 99 | go mod edit -dropreplace github.com/gogf/gf/v2 |
100 | 100 | go mod edit -dropreplace github.com/gogf/gf/contrib/drivers/clickhouse/v2 |
|
0 commit comments