Skip to content

Commit 029f324

Browse files
authored
feat: version v2.9.0-beta (gogf#4189)
1 parent f8331ba commit 029f324

File tree

40 files changed

+207
-171
lines changed

40 files changed

+207
-171
lines changed

.github/workflows/ci-main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@ jobs:
239239
export PATH="$PATH:$(go env GOPATH)/bin"
240240
241241
- name: Before Script
242-
run: bash .github/workflows/before_script.sh
242+
run: bash .github/workflows/scripts/before_script.sh
243243

244244
- name: Build & Test
245245
if: ${{ (github.event_name == 'push' && github.ref != 'refs/heads/master') || github.event_name == 'pull_request' }}
246-
run: bash .github/workflows/ci-main.sh
246+
run: bash .github/workflows/scripts/ci-main.sh
247247

248248
- name: Build & Test & Coverage
249249
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
250-
run: bash .github/workflows/ci-main.sh coverage
250+
run: bash .github/workflows/scripts/ci-main.sh coverage
251251

252252
- name: Stop Redis Cluster Containers
253253
run: docker compose -f ".github/workflows/redis/docker-compose.yml" down

.github/workflows/ci-sub.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ jobs:
6464
cache-dependency-path: '**/go.sum'
6565

6666
- name: Before Script
67-
run: bash .github/workflows/before_script.sh
67+
run: bash .github/workflows/scripts/before_script.sh
6868

6969
- name: Build & Test
70-
run: bash .github/workflows/ci-sub.sh
70+
run: bash .github/workflows/scripts/ci-sub.sh
7171

7272

.github/workflows/doc-build.yml

-38
This file was deleted.
File renamed without changes.

.github/workflows/ci-main.sh .github/workflows/scripts/ci-main.sh

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ coverage=$1
55
# update code of submodules
66
git clone https://github.com/gogf/examples
77

8+
# update go.mod in examples directory to replace github.com/gogf/gf packages with local directory
9+
bash .github/workflows/scripts/replace_examples_gomod.sh
10+
811
# find all path that contains go.mod.
912
for file in `find . -name go.mod`; do
1013
dirpath=$(dirname $file)
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
3+
# Get the absolute path to the repository root
4+
repo_root=$(pwd)
5+
workdir=$repo_root/examples
6+
7+
echo "Prepare to process go.mod files in the ${workdir} directory"
8+
9+
# Check if examples directory exists
10+
if [ ! -d "${workdir}" ]; then
11+
echo "Error: examples directory not found at ${workdir}"
12+
exit 1
13+
fi
14+
15+
# Check if find command is available
16+
if ! command -v find &> /dev/null; then
17+
echo "Error: find command not found!"
18+
exit 1
19+
fi
20+
21+
for file in `find ${workdir} -name go.mod`; do
22+
goModPath=$(dirname $file)
23+
echo ""
24+
echo "Processing dir: $goModPath"
25+
26+
# Calculate relative path to root
27+
# First get the relative path from go.mod to repo root
28+
relativePath=""
29+
current="$goModPath"
30+
while [ "$current" != "$repo_root" ]; do
31+
relativePath="../$relativePath"
32+
current=$(dirname "$current")
33+
done
34+
relativePath=${relativePath%/} # Remove trailing slash
35+
echo "Relative path to root: $relativePath"
36+
37+
# Get all github.com/gogf/gf dependencies
38+
# Use awk to get package names without version numbers
39+
dependencies=$(awk '/^[[:space:]]*github\.com\/gogf\/gf\// {print $1}' "$file" | sort -u)
40+
41+
if [ -n "$dependencies" ]; then
42+
echo "Found GoFrame dependencies:"
43+
echo "$dependencies"
44+
echo "Adding replace directives..."
45+
46+
# Create temporary file
47+
temp_file="${file}.tmp"
48+
# Remove existing replace directives and copy to temp file
49+
sed '/^replace.*github\.com\/gogf\/gf.*/d' "$file" > "$temp_file"
50+
51+
# Add new replace block
52+
echo "" >> "$temp_file"
53+
echo "replace (" >> "$temp_file"
54+
55+
while IFS= read -r dep; do
56+
# Skip empty lines
57+
[ -z "$dep" ] && continue
58+
59+
# Calculate the relative path for the replacement
60+
if [[ "$dep" == "github.com/gogf/gf/v2" ]]; then
61+
replacement="$relativePath"
62+
else
63+
# Extract the path after v2 and remove trailing version
64+
subpath=$(echo "$dep" | sed -E 's/github\.com\/gogf\/gf\/(contrib\/[^/]+\/[^/]+)\/v2.*/\1/')
65+
replacement="$relativePath/$subpath"
66+
fi
67+
68+
echo " $dep => $replacement/" >> "$temp_file"
69+
done <<< "$dependencies"
70+
71+
echo ")" >> "$temp_file"
72+
73+
# Replace original file with temporary file
74+
mv "$temp_file" "$file"
75+
echo "Replace directives added to $file"
76+
else
77+
echo "No GoFrame dependencies found in $file"
78+
fi
79+
done
80+
81+
echo "\nAll go.mod files have been processed successfully."

.make_tidy.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
workdir=.
4+
echo "Prepare to tidy all go.mod files in the ${workdir} directory"
5+
6+
# check find command support or not
7+
output=$(find "${workdir}" -name go.mod 2>&1)
8+
if [[ $? -ne 0 ]]; then
9+
echo "Error: please use bash or zsh to run!"
10+
exit 1
11+
fi
12+
13+
for file in `find ${workdir} -name go.mod`; do
14+
goModPath=$(dirname $file)
15+
echo ""
16+
echo "processing dir: $goModPath"
17+
18+
if [[ $goModPath =~ "/testdata/" ]]; then
19+
echo "ignore testdata path $goModPath"
20+
continue 1
21+
fi
22+
23+
if [[ $goModPath =~ "/examples/" ]]; then
24+
echo "ignore examples path $goModPath"
25+
continue 1
26+
fi
27+
28+
cd $goModPath
29+
go mod tidy
30+
# Remove toolchain line if exists
31+
sed -i '' '/^toolchain/d' go.mod
32+
cd - > /dev/null
33+
done

.set_version.sh .make_version.sh

+13-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717

1818
workdir=.
1919
newVersion=$2
20-
echo "Prepare to replace the GF library version numbers in all go.mod files in the ${workdir} directory with ${newVersion}"
20+
echo "Prepare to replace the GoFrame library version numbers in all go.mod files in the ${workdir} directory with ${newVersion}"
2121

2222
# check find command support or not
2323
output=$(find "${workdir}" -name go.mod 2>&1)
@@ -49,6 +49,11 @@ for file in `find ${workdir} -name go.mod`; do
4949
continue 1
5050
fi
5151

52+
if [[ $goModPath =~ "/examples/" ]]; then
53+
echo "ignore examples path $goModPath"
54+
continue 1
55+
fi
56+
5257
cd $goModPath
5358
if [ $goModPath = "./cmd/gf" ]; then
5459
mv go.work go.work.version.bak
@@ -59,15 +64,18 @@ for file in `find ${workdir} -name go.mod`; do
5964
go mod edit -replace github.com/gogf/gf/contrib/drivers/oracle/v2=../../contrib/drivers/oracle
6065
go mod edit -replace github.com/gogf/gf/contrib/drivers/pgsql/v2=../../contrib/drivers/pgsql
6166
go mod edit -replace github.com/gogf/gf/contrib/drivers/sqlite/v2=../../contrib/drivers/sqlite
62-
# else
63-
# cd -
64-
# continue 1
6567
fi
6668
go mod tidy
67-
# Upgrading only GF related libraries, sometimes even if a version number is specified, it may not be possible to successfully upgrade. Please confirm before submitting the code
69+
# Remove toolchain line if exists
70+
sed -i '' '/^toolchain/d' go.mod
71+
72+
# Upgrading only GoFrame related libraries, sometimes even if a version number is specified,
73+
# it may not be possible to successfully upgrade. Please confirm before submitting the code
6874
go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf"
6975
go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" | xargs -L1 go get -v
7076
go mod tidy
77+
# Remove toolchain line if exists
78+
sed -i '' '/^toolchain/d' go.mod
7179
if [ $goModPath = "./cmd/gf" ]; then
7280
go mod edit -dropreplace github.com/gogf/gf/v2
7381
go mod edit -dropreplace github.com/gogf/gf/contrib/drivers/clickhouse/v2

Makefile

+2-12
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@ SHELL := /bin/bash
33
# execute "go mod tidy" on all folders that have go.mod file
44
.PHONY: tidy
55
tidy:
6-
$(eval files=$(shell find . -name go.mod))
7-
@set -e; \
8-
for file in ${files}; do \
9-
goModPath=$$(dirname $$file); \
10-
if ! echo $$goModPath | grep -q "testdata"; then \
11-
echo "handle: $$goModPath"; \
12-
cd $$goModPath; \
13-
go mod tidy; \
14-
cd -; \
15-
fi \
16-
done
6+
./.make_tidy.sh
177

188
# execute "golangci-lint" to check code style
199
.PHONY: lint
@@ -25,7 +15,7 @@ lint:
2515
version:
2616
@set -e; \
2717
newVersion=$(to); \
28-
./.set_version.sh ./ $$newVersion; \
18+
./.make_version.sh ./ $$newVersion; \
2919
echo "make version to=$(to) done"
3020

3121

README.MD

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A powerful framework for faster, easier, and more efficient project development.
3636
💖 [Thanks to all the contributors who made GoFrame possible](https://github.com/gogf/gf/graphs/contributors) 💖
3737

3838
<a href="https://github.com/gogf/gf/graphs/contributors">
39-
<img src="https://goframe.org/img/contributors.svg?version=v2.8.3" alt="goframe contributors"/>
39+
<img src="https://goframe.org/img/contributors.svg?version=v2.9.0-beta" alt="goframe contributors"/>
4040
</a>
4141

4242
# License

cmd/gf/go.mod

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module github.com/gogf/gf/cmd/gf/v2
22

3-
go 1.20
3+
go 1.22
44

55
require (
6-
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.8.3
7-
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.8.3
8-
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.3
9-
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.8.3
10-
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.3
11-
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.8.3
12-
github.com/gogf/gf/v2 v2.8.3
6+
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.0-beta
7+
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.0-beta
8+
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0-beta
9+
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.0-beta
10+
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.0-beta
11+
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.0-beta
12+
github.com/gogf/gf/v2 v2.9.0-beta
1313
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f
1414
github.com/olekukonko/tablewriter v0.0.5
1515
github.com/schollz/progressbar/v3 v3.15.0
@@ -48,10 +48,10 @@ require (
4848
github.com/rivo/uniseg v0.4.7 // indirect
4949
github.com/shopspring/decimal v1.3.1 // indirect
5050
github.com/sijms/go-ora/v2 v2.7.10 // indirect
51-
go.opentelemetry.io/otel v1.24.0 // indirect
52-
go.opentelemetry.io/otel/metric v1.24.0 // indirect
53-
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
54-
go.opentelemetry.io/otel/trace v1.24.0 // indirect
51+
go.opentelemetry.io/otel v1.32.0 // indirect
52+
go.opentelemetry.io/otel/metric v1.32.0 // indirect
53+
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
54+
go.opentelemetry.io/otel/trace v1.32.0 // indirect
5555
golang.org/x/crypto v0.31.0 // indirect
5656
golang.org/x/net v0.33.0 // indirect
5757
golang.org/x/sync v0.10.0 // indirect

0 commit comments

Comments
 (0)