需要 Go 1.25 或更高版本,低版本无法编译;示例服务默认监听 8000 端口,注意端口占用;使用 gf 命令前需先单独安装 CLI

gf
gogfMIT活跃维护GoFrame 是一套 Go 语言企业级开发框架,内置 ORM、日志、链路追踪和微服务组件,帮团队少拼装基础库、更快搭出稳定后端服务。
A powerful framework for faster, easier, and more efficient project development.
go get -u github.com/gogf/gf/v2
go install github.com/gogf/gf/cmd/gf/v2@latestREADME 未说明,仅要求 Go 1.25 或更高版本
GoFrame 是 Go 语言的全栈开发框架,可整体使用也可按需取用组件
GoFrame 是一套 Go 语言企业级开发框架,内置 ORM、日志、链路追踪和微服务组件,帮团队少拼装基础库、更快搭出稳定后端服务。
核心能力
- 提供 ghttp 等组件,几行代码即可启动 HTTP 服务
- 既可作完整应用框架,也可单独引入所需组件
- 附带 gf CLI,可初始化项目脚手架并运行
- 框架代码 100% 开源,采用 MIT 许可
容易踩的坑
- v2.10.4GoFrame Release v2.10.4最新正式版2026-10-28 · 2026-10-28 02:41 UTC
What's Changed
feat
- feat: add gf-pr-create skill and refresh root README by @gqcn in https://github.com/gogf/gf/pull/4878
- feat(agents): parallelize gf-pr-review and honor existing comments by @gqcn in https://github.com/gogf/gf/pull/4879
- feat(agents): extend pr review and drop openspec workflow by @gqcn in https://github.com/gogf/gf/pull/4911
- feat(cmd/gf): add gf agents for local coding-agent setup by @gqcn in https://github.com/gogf/gf/pull/4877
- feat(net/ghttp,net/goai): support JSON array request body by the in:"body" field tag by @LanceAdd in https://github.com/gogf/gf/pull/4898
- feat(net/ghttp): add exported HTTP header name constants by @LanceAdd in https://github.com/gogf/gf/pull/4899
fix
- fix: update gf cli to v2.10.3 by @github-actions[bot] in https://github.com/gogf/gf/pull/4867
- fix: v2.10.4 by @hailaz in https://github.com/gogf/gf/pull/4941
- fix(cmd/gf): reimplement GoFmt to avoid go env subprocess per file by @hailaz in https://github.com/gogf/gf/pull/4929
- fix(cmd/gf): avoid duplicate imports when ensuring an existing path by @LanceAdd in https://github.com/gogf/gf/pull/4945
- fix(contrib/drivers/clickhouse): correct conversion, inserts, rewriting by @lingcoder in https://github.com/gogf/gf/pull/4916
- fix(contrib/drivers/dm): preserve quoted identifiers by @yuyinw in https://github.com/gogf/gf/pull/4828
- fix(contrib/drivers/dm): read metadata columns ignoring column name case by @z312193608 in https://github.com/gogf/gf/pull/4875
- fix(contrib/drivers/dm): apply timezone to DM DSN by @014-code in https://github.com/gogf/gf/pull/4904
- fix(contrib/drivers/dm): expand test coverage to the Oracle baseline + 18 driver fixes by @lingcoder in https://github.com/gogf/gf/pull/4925
- fix(contrib/drivers/gaussdb): read int1[] and int16[] arrays back as arrays by @lingcoder in https://github.com/gogf/gf/pull/4896
- fix(contrib/drivers/mssql): expand test coverage to the MySQL baseline + 16 driver fixes by @lingcoder in https://github.com/gogf/gf/pull/4924
- fix(contrib/drivers/oracle): fix GBK decode and quoted identifiers by @yuyinw in https://github.com/gogf/gf/pull/4836
- fix(contrib/drivers/oracle): bring the driver up to the MySQL test baseline by @lingcoder in https://github.com/gogf/gf/pull/4906
- fix(contrib/drivers/pgsql): preserve timetz time zone offsets by @014-code in https://github.com/gogf/gf/pull/4903
- fix(contrib/drivers/sqlite): infer save conflict from primary keys by @gqcn in https://github.com/gogf/gf/pull/4766
- fix(contrib/drivers/sqlite): exclude internal tables from DAO discovery by @allenflux in https://github.com/gogf/gf/pull/4908
- fix(contrib/registry/nacos, contrib/config/nacos): update nacos-sdk-go to 70993e7 by @lingcoder in https://github.com/gogf/gf/pull/4888
- fix(contrib/registry/nacos): add Option pattern for registry configuration by @ShryukGrandhi in https://github.com/gogf/gf/pull/4938
- fix(contrib/registry/zookeeper): keep other instances when registering a service by @taekop in https://github.com/gogf/gf/pull/4907
- fix(database/gdb): map database type names exactly in each driver instead of guessing from substrings by @lingcoder in https://github.com/gogf/gf/pull/4882
- fix(database/gdb): preserve mixed values in undeclared columns by @allenflux in https://github.com/gogf/gf/pull/4905
- fix(database/gdb): cache forced empty results by @sean0407 in https://github.com/gogf/gf/pull/4919
- fix(database/gdb): treat empty TxOptions.Propagation as the default by @somaz94 in https://github.com/gogf/gf/pull/4926
- fix(net/gclient): remove dead request body read in tracing tracer by @LanceAdd in https://github.com/gogf/gf/pull/4900
- fix(net/ghttp): avoid the nil serving handler panic on the request struct parsing by @LanceAdd in https://github.com/gogf/gf/pull/4901
- fix(net/ghttp): avoid nil serveHandler panic on unmatched route parsing by @LanceAdd in https://github.com/gogf/gf/pull/4912
- fix(net/ghttp): strip the whol
- v2.10.3GoFrame Release v2.10.32026-08-26 · 2026-08-26 02:30 UTC
查看更新说明
What's Changed
- fix: update gf cli to v2.10.2 by @github-actions[bot] in https://github.com/gogf/gf/pull/4773
- feat(cmd/gf): gen dao suppport for dm database by @hailaz in https://github.com/gogf/gf/pull/4776
- fix(ghttp): resolve the issue where the GetCertificate callback in TLS listener gets overwritten by @cashtang in https://github.com/gogf/gf/pull/4789
- fix(net/ghttp): report invalid json body errors by @puneetdixit200 in https://github.com/gogf/gf/pull/4775
- fix(gclient): add timeout configuration methods and improve client initialization by @hailaz in https://github.com/gogf/gf/pull/4779
- fix(cmd/gf): missing pointer in generated service file (#4741) by @UncleChair in https://github.com/gogf/gf/pull/4742
- fix(util/gvalid): date validation allows invalid formats like Y-MMMM and invalid dates like 2026-13-33 by @cococolanosugar in https://github.com/gogf/gf/pull/4740
- fix(container/gmap): added WithError methods for KVMap and ListKVMap by @LanceAdd in https://github.com/gogf/gf/pull/4714
- feat(contrib/drivers/mssql): convert uniqueidentifier to uuid.UUID by @NickWilde18 in https://github.com/gogf/gf/pull/4756
- fix(os/glog): JsonHandler outputs flat JSON suitable for ES ingestion (#4790) by @yangyanqing in https://github.com/gogf/gf/pull/4791
- feat(database/gdb): Added OmitZero function to filter zero value parameters by @LanceAdd in https://github.com/gogf/gf/pull/4713
- Revert "feat(database/gdb): Added OmitZero function to filter zero value parameters" by @hailaz in https://github.com/gogf/gf/pull/4818
- fix(net/ghttp): normalize HTTP method to uppercase in getHandlersWithCache to prevent route cache pollution (#4765) by @waterWang in https://github.com/gogf/gf/pull/4812
- fix(os/gcfg): normalize config pattern in GetWithEnv by @webguosai in https://github.com/gogf/gf/pull/4748
- fix(encoding/ghash): PJW64 should use 64-bit width by @guoxing-li in https://github.com/gogf/gf/pull/4728
- fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) by @waterWang in https://github.com/gogf/gf/pull/4813
- feat(os/grpool): let can set limit/cap dynamically by @joy999 in https://github.com/gogf/gf/pull/4794
- test(contrib/drivers/pgsql): expand test coverage to MySQL/MariaDB baseline + 3 framework fixes by @lingcoder in https://github.com/gogf/gf/pull/4763
- fix(net/ghttp): use a case-preserving key for the router searching cache by @lingcoder in https://github.com/gogf/gf/pull/4833
- chore(openspec): remove openspec docs from repo by @gqcn in https://github.com/gogf/gf/pull/4838
- fix(util/gconv): support array-backed unmarshalling values by @ErzerLP in https://github.com/gogf/gf/pull/4810
- fix(net/ghttp): windows web admin restart only shutdowns but doesn't restart by @lonevle in https://github.com/gogf/gf/pull/4809
- feat(container/gtree): Add the function of popping left and right nodes of red-black tree by @LanceAdd in https://github.com/gogf/gf/pull/4793
- feat:To support the loong64 architecture upgrade, we have upgraded go-sqlite and modernc.org/libc. by @lijunting2020 in https://github.com/gogf/gf/pull/4847
- fix(util/gconv): unwrap reflect.Value and support pointer element slices by @hailaz in https://github.com/gogf/gf/pull/4848
- fix(net/goai): nil pointer dereference when an array with enum has an interface element (#4746) by @lingcoder in https://github.com/gogf/gf/pull/4844
- ci: update the CI/CD dependency versions and scripts by @lingcoder in https://github.com/gogf/gf/pull/4852
- fix(os/grpool): stop Test_Limit4 asserting a sum that has a race window by @lingcoder in https://github.com/gogf/gf/pull/4854
- fix(contrib/nacos): move to the upstream commit that fixes the RpcClient data race by @lingcoder in https://github.com/gogf/gf/pull/4856
- ci: make the Apollo and nacos containers actually ready before tests run by @lingcoder in https://github.com/gogf/gf/pull/4857
- fix(database/gdb): stop reporting an aborted row iteration as
- v2.10.2GoFrame Release v2.10.22026-05-14 · 2026-05-14 08:15 UTC
查看更新说明
What's Changed
- fix: update gf cli to v2.10.1 by @github-actions[bot] in https://github.com/gogf/gf/pull/4770
- refactor(cmd/gf): improve code structure for readability and maintainability by @hailaz in https://github.com/gogf/gf/pull/4771
Full Changelog: https://github.com/gogf/gf/compare/v2.10.1...v2.10.2
- v2.10.1GoFrame Release v2.10.12026-05-14 · 2026-05-14 05:43 UTC
查看更新说明
What's Changed
- fix: update gf cli to v2.10.0 by @github-actions[bot] in https://github.com/gogf/gf/pull/4658
- docs: Update README Add DeepWiki badges by @hailaz in https://github.com/gogf/gf/pull/4661
- test(contrib/drivers/gaussdb): add builder, subquery, join, struct test coverage by @lingcoder in https://github.com/gogf/gf/pull/4688
- test(contrib/drivers/pgsql): add Builder/Subquery/Join/Struct tests by @lingcoder in https://github.com/gogf/gf/pull/4680
- fix(registry/etcd): etcd.NewWithClient() has no DialTimeout by @shengdoushi in https://github.com/gogf/gf/pull/4670
- fix(contrib/registry): etcd doKeepAlive does not exit even when client context done by @yuluo-yx in https://github.com/gogf/gf/pull/4669
- chore: cleanup makefile, remove unnecessary scripts by @gqcn in https://github.com/gogf/gf/pull/4684
- test(contrib/drivers/gaussdb): add union, DO, raw where test coverage by @lingcoder in https://github.com/gogf/gf/pull/4687
- test(contrib/drivers/pgsql): add Union, DO and Raw Where test coverage by @lingcoder in https://github.com/gogf/gf/pull/4679
- feat(i18n/gi18n): decoding and loading i18n files content by automatic file extension check by @The-night-elves in https://github.com/gogf/gf/pull/4662
- test(contrib/drivers/gaussdb): add transaction, where, hook, ctx test coverage by @lingcoder in https://github.com/gogf/gf/pull/4685
- test(contrib/drivers/pgsql): add transaction, where, hook, ctx test coverage by @lingcoder in https://github.com/gogf/gf/pull/4675
- feat(os/gcfg): add GetEffective method with standard config priority by @lingcoder in https://github.com/gogf/gf/pull/4673
- feat(gcrypto/gsha512): add sha512 implements by @yuluo-yx in https://github.com/gogf/gf/pull/4667
- test(contrib/drivers/pgsql): add SoftTime, With, ScanList test coverage by @lingcoder in https://github.com/gogf/gf/pull/4676
- test(contrib/drivers/gaussdb): add soft time, with, scanlist test coverage by @lingcoder in https://github.com/gogf/gf/pull/4686
- test(contrib/drivers/mysql): add Lock/Omit/Cache/Batch tests by @lingcoder in https://github.com/gogf/gf/pull/4706
- fix(database/gdb): handle empty string in Fields() gracefully by @lingcoder in https://github.com/gogf/gf/pull/4700
- test(contrib/drivers/mysql): add concurrent/Hook/Ctx tests by @lingcoder in https://github.com/gogf/gf/pull/4708
- test(contrib/drivers/mysql): add MySQL-specific feature tests by @lingcoder in https://github.com/gogf/gf/pull/4709
- test(contrib/drivers/mysql): enhance complex query tests by @lingcoder in https://github.com/gogf/gf/pull/4707
- test(contrib/drivers/mysql): enhance data type tests by @lingcoder in https://github.com/gogf/gf/pull/4705
- test(contrib/drivers/mysql): enhance transaction tests by @lingcoder in https://github.com/gogf/gf/pull/4704
- fix(database/gdb): treat negative Limit/Page/Offset values as zero by @lingcoder in https://github.com/gogf/gf/pull/4702
- fix(databse/gdb): use COUNT(1) if fields number is greater than 1 even when parameter
useFieldForCountis true in AllAndCount/ScanAndCount by @lingcoder in https://github.com/gogf/gf/pull/4701 - fix(os/gstructs): strip tag options in TagPriorityName to avoid field name pollution by @lingcoder in https://github.com/gogf/gf/pull/4681
- fix(contrib/drivers/pgsql): preserve bytea data integrity on read and write by @lingcoder in https://github.com/gogf/gf/pull/4678
- test(contrib/drivers/mysql): add pagination and error handling tests by @lingcoder in https://github.com/gogf/gf/pull/4703
- test(contrib/drivers/mariadb): add pagination, error, concurrent, rawtype and sharding tests by @lingcoder in https://github.com/gogf/gf/pull/4723
- test(contrib/drivers/mariadb): add builder, struct, join, batch, cache and omit tests by @lingcoder in https://github.com/gogf/gf/pull/4722
- test(contrib/drivers/mariadb): add softtime, with, scanlist, union and do tests by @lingcoder in https://github.com/gogf/gf/pull/4721
- test(contrib/drivers/mariadb): ad
- v2.10.0GoFrame Release v2.10.02026-01-26 · 2026-01-26 12:53 UTC
查看更新说明
What's Changed
Feature
- feat: update linter config and deprecation notice by @houseme in https://github.com/gogf/gf/pull/4399
- feat(ci): upgrade workflow checkout version v5 by @houseme in https://github.com/gogf/gf/pull/4381
- feat(cmd/gendao): add wildcard pattern support for tables configuration by @lingcoder in https://github.com/gogf/gf/pull/4632
- feat(cmd/gf): add broad matching to gf gen dao's tableEx attribute. by @joy999 in https://github.com/gogf/gf/pull/4453
- feat(cmd/gf): Add support for the Loongson architecture (loong64) by @LanceAdd in https://github.com/gogf/gf/pull/4467
- feat(cmd/gf): improve and enhance gen ctrl by @oldme-git in https://github.com/gogf/gf/pull/4325
- feat(cmd/gf): improve gf run watching by @hailaz in https://github.com/gogf/gf/pull/4573
- feat(cmd/gf): init update by @hailaz in https://github.com/gogf/gf/pull/4572
- feat(container): Add NewXXXWithChecker function for gmap/gset/gtree by @LanceAdd in https://github.com/gogf/gf/pull/4610
- feat(container/garray): add TArray by @joy999 in https://github.com/gogf/gf/pull/4466
- feat(container/garray): enhance generic array implements by @joy999 in https://github.com/gogf/gf/pull/4482
- feat(container/garray): Sorted T Array by @joy999 in https://github.com/gogf/gf/pull/4470
- feat(container/glist): add generic list feature by @joy999 in https://github.com/gogf/gf/pull/4483
- feat(container/gmap): add generic list map feature by @joy999 in https://github.com/gogf/gf/pull/4520
- feat(container/gmap): add generic map feature by @joy999 in https://github.com/gogf/gf/pull/4484
- feat(container/gpool): add generic pool feature by @joy999 in https://github.com/gogf/gf/pull/4493
- feat(container/gqueue): add generic queuefeature by @joy999 in https://github.com/gogf/gf/pull/4497
- feat(container/gring): add generic ring feature by @joy999 in https://github.com/gogf/gf/pull/4496
- feat(container/gset): add generic set feature by @joy999 in https://github.com/gogf/gf/pull/4492
- feat(container/gtree): add generic tree feature by @joy999 in https://github.com/gogf/gf/pull/4522
- feat(contrib/drivers): more database drivers by @gqcn in https://github.com/gogf/gf/pull/4553
- feat(contrib/drivers/dm): add
Replace/InsertIgnoresupport and field type/length enhancements for dm database by @gqcn in https://github.com/gogf/gf/pull/4541 - feat(contrib/drivers/dm): add
WherePrisupport by @tiger1103 in https://github.com/gogf/gf/pull/4157 - feat(contrib/drivers/dm&pgsql&mssql&oracle): add Replace/LastInsertId features support for dm/pgsql/mssql/oracle by @gqcn in https://github.com/gogf/gf/pull/4547
- feat(contrib/drivers/gaussdb): add gaussdb driver support by @gqcn in https://github.com/gogf/gf/pull/4563
- feat(contrib/drivers/mssql): mssql support LastInsertId by @lxy1151 in https://github.com/gogf/gf/pull/4051
- feat(contrib/drivers/pgsql): add array type numeric[] and decimal[] converting to Go []float64 support #4457 by @The-night-elves in https://github.com/gogf/gf/pull/4511
- feat(contrib/drivers/pgsql): more field types converting support by @ivothgle in https://github.com/gogf/gf/pull/3737
- feat(contrib/registry): update nacos sdk to 2.3.5 by @yuluo-yx in https://github.com/gogf/gf/pull/4628
- feat(contrib/registry/nacos): add SetDefaultEndpoint and SetDefaultMetadata methods by @wangle201210 in https://github.com/gogf/gf/pull/4608
- feat(crypto): add gsha256 by @joy999 in https://github.com/gogf/gf/pull/4558
- feat(crypto/grsa): Add RSA encryption and decryption function by @LanceAdd in https://github.com/gogf/gf/pull/4571
- feat(database/gdb): add MaxIdleConnTime configuration for SetConnMaxIdleTime support by @lingcoder in https://github.com/gogf/gf/pull/4625
- feat(database/gdb): Add the function of obtaining all configurations to facilitate business operations such as verification after addition. by @sxp20008 in https://github.com/gogf/gf/pull/4389
- feat(database/gdb): Optimize SoftTime feature
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
English | 简体中文
GoFrame is a powerful framework for faster, easier, and more efficient project development.
Use it as a full application framework, or pick individual components as needed.
Installation
GoFrame requires Go 1.25 or later.
In an existing module, add the framework:
go get -u github.com/gogf/gf/v2
Install the gf CLI:
go install github.com/gogf/gf/cmd/gf/v2@latest
Usage
Create main.go:
package main
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request) {
r.Response.Write("Hello World!")
})
s.SetPort(8000)
s.Run()
}
Run it:
go mod init hello
go mod tidy
go run main.go
Open http://127.0.0.1:8000.
To scaffold a project with the gf CLI:
gf init hello
cd hello && gf run main.go
Documentation
- Official Site: https://goframe.org
- Official Site(en): https://goframe.org/en
- 国内镜像:https://goframe.org.cn
- Mirror Site: https://pages.goframe.org
- Mirror Site: Offline Docs
- GoDoc API: https://pkg.go.dev/github.com/gogf/gf/v2
- Doc Source: https://github.com/gogf/gf-site
Contributors
💖 Thanks to all the contributors who made GoFrame possible 💖
License
GoFrame is licensed under the MIT License, 100% free and open-source, forever.