Compare commits

...

3 Commits

Author SHA1 Message Date
9a91bd203b fix: v2.10.2 (#4772)
fixed #4750
fixed #4757
fixed #4767
2026-05-14 16:00:16 +08:00
72733e0bad refactor(cmd/gf): improve code structure for readability and maintainability (#4771)
Refactor the code structure to enhance readability and maintainability
without altering functionality.

fixed #4750 #4757 #4767

另外使用`gf init -r github.com/gogf/template-single my-project`方式没有问题

合并后v2.10.2生效
2026-05-14 15:34:43 +08:00
d44e082ff5 fix: update gf cli to v2.10.1 (#4770)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action

Co-authored-by: gqcn <gqcn@users.noreply.github.com>
2026-05-14 14:31:30 +08:00
41 changed files with 57 additions and 56 deletions

View File

@ -34,6 +34,7 @@ branch:
version:
@set -e; \
newVersion=$(to); \
$(MAKE) -C cmd/gf pack; \
./.make_version.sh ./ $$newVersion; \
echo "make version to=$(to) done"

View File

@ -46,7 +46,7 @@ go get -u github.com/gogf/gf/v2
💖 [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.10.1" alt="goframe contributors"/>
<img src="https://goframe.org/img/contributors.svg?version=v2.10.2" alt="goframe contributors"/>
</a>
## License

View File

@ -46,7 +46,7 @@ go get -u github.com/gogf/gf/v2
💖 [感谢所有使 GoFrame 成为可能的贡献者](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.10.1" alt="goframe contributors"/>
<img src="https://goframe.org/img/contributors.svg?version=v2.10.2" alt="goframe contributors"/>
</a>
## 许可证

View File

@ -18,9 +18,6 @@ pack.template-mono:
@cd temp && gf pack template-mono ../internal/packed/template-mono.go -n=packed -y
@rm -fr temp
# Note:
# command `sed` only works on MacOS.
# use `grep -irl 'template-single' temp| xargs sed -i'' -e 's/template-single/template-mono-app/g'` on other platforms.
pack.template-mono-app:
@rm -fr temp
@mkdir temp || exit 0
@ -31,6 +28,6 @@ pack.template-mono-app:
@rm -fr temp/template-mono-app/.gitignore
@rm -fr temp/template-mono-app/go.mod
@rm -fr temp/template-mono-app/go.sum
@grep -irl 'template-single' temp| xargs sed -i '' -e 's/template-single/template-mono-app/g'
@grep -irl 'template-single' temp| xargs perl -pi -e 's/template-single/template-mono-app/g'
@cd temp && gf pack template-mono-app ../internal/packed/template-mono-app.go -n=packed -y
@rm -fr temp

View File

@ -3,13 +3,13 @@ module github.com/gogf/gf/cmd/gf/v2
go 1.23.0
require (
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.10.2
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.10.2
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.2
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.10.2
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.2
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.10.2
github.com/gogf/gf/v2 v2.10.2
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f
github.com/olekukonko/tablewriter v1.1.0
github.com/schollz/progressbar/v3 v3.15.0

View File

@ -232,14 +232,17 @@ func (c cInit) initFromBuiltin(ctx context.Context, in cInitInput) (out *cInitOu
return content
}
}
mlog.Debugf("replace %s %s to %s", path, cInitRepoPrefix+templateRepoName, in.Module)
return gstr.Replace(gfile.GetContents(path), cInitRepoPrefix+templateRepoName, in.Module)
}, in.Name, "*", true)
if err != nil {
return
}
// Format the generated Go files.
utils.GoFmt(in.Name)
// Format the generated Go files using go/format (not goimports).
// utils.GoFmt uses imports.Process which may remove local import paths that cannot
// be resolved in the GOPATH or module cache right after generation (e.g. "myapp/api/hello/v1").
geninit.FormatGoFiles(in.Name)
// Update the GoFrame version.
if in.Update {

View File

@ -85,7 +85,7 @@ func generateProject(ctx context.Context, srcPath, name, oldModule, newModule st
// 6. Format the generated Go files using go/format (not imports.Process)
// Note: We use formatGoFiles instead of utils.GoFmt because imports.Process
// may incorrectly "fix" local import paths by replacing them with cached module paths.
formatGoFiles(dstPath)
FormatGoFiles(dstPath)
mlog.Print("Project generated successfully!")
return nil
@ -115,10 +115,10 @@ func upgradeDependencies(ctx context.Context, projectDir string) error {
return nil
}
// formatGoFiles formats all Go files in the directory using go/format.
// FormatGoFiles formats all Go files in the directory using go/format.
// Unlike imports.Process, this only formats code without modifying imports,
// which prevents incorrect "fixing" of local import paths.
func formatGoFiles(dir string) {
func FormatGoFiles(dir string) {
files, err := findGoFiles(dir)
if err != nil {
mlog.Printf("Failed to find Go files for formatting: %v", err)

View File

@ -4,7 +4,7 @@ go 1.23.0
toolchain go1.24.6
require github.com/gogf/gf/v2 v2.10.0
require github.com/gogf/gf/v2 v2.10.1
require (
go.opentelemetry.io/otel v1.38.0 // indirect

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
github.com/apolloconfig/agollo/v4 v4.3.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/consul/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/hashicorp/consul/api v1.24.0
github.com/hashicorp/go-cleanhttp v0.5.2
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/kubecm/v2
go 1.24.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
k8s.io/api v0.33.4
k8s.io/apimachinery v0.33.4
k8s.io/client-go v0.33.4

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/nacos/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/nacos-group/nacos-sdk-go/v2 v2.3.3
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/polaris/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/polarismesh/polaris-go v1.6.1
)

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
github.com/ClickHouse/clickhouse-go/v2 v2.0.15
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/google/uuid v1.6.0
github.com/shopspring/decimal v1.3.1
)

View File

@ -6,7 +6,7 @@ replace github.com/gogf/gf/v2 => ../../../
require (
gitee.com/chunanyong/dm v1.8.12
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
gitee.com/opengauss/openGauss-connector-go-pq v1.0.7
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/google/uuid v1.6.0
)

View File

@ -3,8 +3,8 @@ module github.com/gogf/gf/contrib/drivers/mariadb/v2
go 1.23.0
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.2
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/mssql/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/microsoft/go-mssqldb v1.7.1
)

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
github.com/go-sql-driver/mysql v1.7.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,8 +3,8 @@ module github.com/gogf/gf/contrib/drivers/oceanbase/v2
go 1.23.0
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.2
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/oracle/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/sijms/go-ora/v2 v2.7.10
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/pgsql/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
)

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
github.com/glebarez/go-sqlite v1.21.2
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/sqlitecgo/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/mattn/go-sqlite3 v1.14.17
)

View File

@ -3,8 +3,8 @@ module github.com/gogf/gf/contrib/drivers/tidb/v2
go 1.23.0
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.10.2
github.com/gogf/gf/v2 v2.10.2
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/metric/otelmetric/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/prometheus/client_golang v1.23.2
go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0
go.opentelemetry.io/otel v1.38.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/nosql/redis/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/redis/go-redis/v9 v9.12.1
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/trace v1.38.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/consul/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/hashicorp/consul/api v1.26.1
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/etcd/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
go.etcd.io/etcd/client/v3 v3.5.17
google.golang.org/grpc v1.59.0
)

View File

@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/registry/file/v2
go 1.23.0
require github.com/gogf/gf/v2 v2.10.1
require github.com/gogf/gf/v2 v2.10.2
require (
github.com/BurntSushi/toml v1.5.0 // indirect

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/nacos/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/nacos-group/nacos-sdk-go/v2 v2.3.5
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/polaris/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
github.com/polarismesh/polaris-go v1.6.1
)

View File

@ -4,7 +4,7 @@ go 1.23.0
require (
github.com/go-zookeeper/zk v1.0.3
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
golang.org/x/sync v0.16.0
)

View File

@ -3,8 +3,8 @@ module github.com/gogf/gf/contrib/rpc/grpcx/v2
go 1.23.0
require (
github.com/gogf/gf/contrib/registry/file/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/contrib/registry/file/v2 v2.10.2
github.com/gogf/gf/v2 v2.10.2
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/trace v1.38.0
google.golang.org/grpc v1.64.1

View File

@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/sdk/httpclient/v2
go 1.23.0
require github.com/gogf/gf/v2 v2.10.1
require github.com/gogf/gf/v2 v2.10.2
require (
github.com/BurntSushi/toml v1.5.0 // indirect

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/trace/otlpgrpc/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/trace/otlphttp/v2
go 1.23.0
require (
github.com/gogf/gf/v2 v2.10.1
github.com/gogf/gf/v2 v2.10.2
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0

View File

@ -2,5 +2,5 @@ package gf
const (
// VERSION is the current GoFrame version.
VERSION = "v2.10.1"
VERSION = "v2.10.2"
)