Skip to content

Commit

Permalink
feat: version v2.9.0-beta (#4189)
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn authored Mar 9, 2025
1 parent f8331ba commit 029f324
Show file tree
Hide file tree
Showing 40 changed files with 207 additions and 171 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ jobs:
export PATH="$PATH:$(go env GOPATH)/bin"
- name: Before Script
run: bash .github/workflows/before_script.sh
run: bash .github/workflows/scripts/before_script.sh

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

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

- name: Stop Redis Cluster Containers
run: docker compose -f ".github/workflows/redis/docker-compose.yml" down
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ jobs:
cache-dependency-path: '**/go.sum'

- name: Before Script
run: bash .github/workflows/before_script.sh
run: bash .github/workflows/scripts/before_script.sh

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


38 changes: 0 additions & 38 deletions .github/workflows/doc-build.yml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ coverage=$1
# update code of submodules
git clone https://github.com/gogf/examples

# update go.mod in examples directory to replace github.com/gogf/gf packages with local directory
bash .github/workflows/scripts/replace_examples_gomod.sh

# find all path that contains go.mod.
for file in `find . -name go.mod`; do
dirpath=$(dirname $file)
Expand Down
File renamed without changes.
81 changes: 81 additions & 0 deletions .github/workflows/scripts/replace_examples_gomod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash

# Get the absolute path to the repository root
repo_root=$(pwd)
workdir=$repo_root/examples

echo "Prepare to process go.mod files in the ${workdir} directory"

# Check if examples directory exists
if [ ! -d "${workdir}" ]; then
echo "Error: examples directory not found at ${workdir}"
exit 1
fi

# Check if find command is available
if ! command -v find &> /dev/null; then
echo "Error: find command not found!"
exit 1
fi

for file in `find ${workdir} -name go.mod`; do
goModPath=$(dirname $file)
echo ""
echo "Processing dir: $goModPath"

# Calculate relative path to root
# First get the relative path from go.mod to repo root
relativePath=""
current="$goModPath"
while [ "$current" != "$repo_root" ]; do
relativePath="../$relativePath"
current=$(dirname "$current")
done
relativePath=${relativePath%/} # Remove trailing slash
echo "Relative path to root: $relativePath"

# Get all github.com/gogf/gf dependencies
# Use awk to get package names without version numbers
dependencies=$(awk '/^[[:space:]]*github\.com\/gogf\/gf\// {print $1}' "$file" | sort -u)

if [ -n "$dependencies" ]; then
echo "Found GoFrame dependencies:"
echo "$dependencies"
echo "Adding replace directives..."

# Create temporary file
temp_file="${file}.tmp"
# Remove existing replace directives and copy to temp file
sed '/^replace.*github\.com\/gogf\/gf.*/d' "$file" > "$temp_file"

# Add new replace block
echo "" >> "$temp_file"
echo "replace (" >> "$temp_file"

while IFS= read -r dep; do
# Skip empty lines
[ -z "$dep" ] && continue

# Calculate the relative path for the replacement
if [[ "$dep" == "github.com/gogf/gf/v2" ]]; then
replacement="$relativePath"
else
# Extract the path after v2 and remove trailing version
subpath=$(echo "$dep" | sed -E 's/github\.com\/gogf\/gf\/(contrib\/[^/]+\/[^/]+)\/v2.*/\1/')
replacement="$relativePath/$subpath"
fi

echo " $dep => $replacement/" >> "$temp_file"
done <<< "$dependencies"

echo ")" >> "$temp_file"

# Replace original file with temporary file
mv "$temp_file" "$file"
echo "Replace directives added to $file"
else
echo "No GoFrame dependencies found in $file"
fi
done

echo "\nAll go.mod files have been processed successfully."
33 changes: 33 additions & 0 deletions .make_tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

workdir=.
echo "Prepare to tidy all go.mod files in the ${workdir} directory"

# check find command support or not
output=$(find "${workdir}" -name go.mod 2>&1)
if [[ $? -ne 0 ]]; then
echo "Error: please use bash or zsh to run!"
exit 1
fi

for file in `find ${workdir} -name go.mod`; do
goModPath=$(dirname $file)
echo ""
echo "processing dir: $goModPath"

if [[ $goModPath =~ "/testdata/" ]]; then
echo "ignore testdata path $goModPath"
continue 1
fi

if [[ $goModPath =~ "/examples/" ]]; then
echo "ignore examples path $goModPath"
continue 1
fi

cd $goModPath
go mod tidy
# Remove toolchain line if exists
sed -i '' '/^toolchain/d' go.mod
cd - > /dev/null
done
18 changes: 13 additions & 5 deletions .set_version.sh → .make_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi

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

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

if [[ $goModPath =~ "/examples/" ]]; then
echo "ignore examples path $goModPath"
continue 1
fi

cd $goModPath
if [ $goModPath = "./cmd/gf" ]; then
mv go.work go.work.version.bak
Expand All @@ -59,15 +64,18 @@ for file in `find ${workdir} -name go.mod`; do
go mod edit -replace github.com/gogf/gf/contrib/drivers/oracle/v2=../../contrib/drivers/oracle
go mod edit -replace github.com/gogf/gf/contrib/drivers/pgsql/v2=../../contrib/drivers/pgsql
go mod edit -replace github.com/gogf/gf/contrib/drivers/sqlite/v2=../../contrib/drivers/sqlite
# else
# cd -
# continue 1
fi
go mod tidy
# 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
# Remove toolchain line if exists
sed -i '' '/^toolchain/d' go.mod

# Upgrading only GoFrame related libraries, sometimes even if a version number is specified,
# it may not be possible to successfully upgrade. Please confirm before submitting the code
go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf"
go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@${newVersion}{{end}}" -m all | grep "^github.com/gogf/gf" | xargs -L1 go get -v
go mod tidy
# Remove toolchain line if exists
sed -i '' '/^toolchain/d' go.mod
if [ $goModPath = "./cmd/gf" ]; then
go mod edit -dropreplace github.com/gogf/gf/v2
go mod edit -dropreplace github.com/gogf/gf/contrib/drivers/clickhouse/v2
Expand Down
14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@ SHELL := /bin/bash
# execute "go mod tidy" on all folders that have go.mod file
.PHONY: tidy
tidy:
$(eval files=$(shell find . -name go.mod))
@set -e; \
for file in ${files}; do \
goModPath=$$(dirname $$file); \
if ! echo $$goModPath | grep -q "testdata"; then \
echo "handle: $$goModPath"; \
cd $$goModPath; \
go mod tidy; \
cd -; \
fi \
done
./.make_tidy.sh

# execute "golangci-lint" to check code style
.PHONY: lint
Expand All @@ -25,7 +15,7 @@ lint:
version:
@set -e; \
newVersion=$(to); \
./.set_version.sh ./ $$newVersion; \
./.make_version.sh ./ $$newVersion; \
echo "make version to=$(to) done"


Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ A powerful framework for faster, easier, and more efficient project development.
💖 [Thanks to all the contributors who made GoFrame possible](https://github.com/gogf/gf/graphs/contributors) 💖

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

# License
Expand Down
24 changes: 12 additions & 12 deletions cmd/gf/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/gogf/gf/cmd/gf/v2

go 1.20
go 1.22

require (
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.8.3
github.com/gogf/gf/v2 v2.8.3
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.9.0-beta
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.9.0-beta
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0-beta
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.9.0-beta
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.0-beta
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.9.0-beta
github.com/gogf/gf/v2 v2.9.0-beta
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f
github.com/olekukonko/tablewriter v0.0.5
github.com/schollz/progressbar/v3 v3.15.0
Expand Down Expand Up @@ -48,10 +48,10 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sijms/go-ora/v2 v2.7.10 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
Expand Down
Loading

0 comments on commit 029f324

Please sign in to comment.