Skip to content

feat(cmd/gf): gen dao suppport for dm database#4776

Merged
gqcn merged 1 commit into
masterfrom
feat/tagsdm
May 28, 2026
Merged

feat(cmd/gf): gen dao suppport for dm database#4776
gqcn merged 1 commit into
masterfrom
feat/tagsdm

Conversation

@hailaz

@hailaz hailaz commented May 25, 2026

Copy link
Copy Markdown
Contributor
将来合并后直接指定tag
go run -tags dm github.com/gogf/gf/cmd/gf/v2@latest
go install -tags dm github.com/gogf/gf/cmd/gf/v2@latest

测试
go run -tags dm github.com/gogf/gf/cmd/gf/v2@a7f551c40f3c83b00eae15a65fd4463332b1ed2e
go install -tags dm github.com/gogf/gf/cmd/gf/v2@a7f551c40f3c83b00eae15a65fd4463332b1ed2e

Copilot AI review requested due to automatic review settings May 25, 2026 03:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional support for the 达梦 (DM) database driver in the gf CLI DAO generator by gating the DM driver import behind a dm build tag, enabling go run|install -tags dm ... usage without impacting default builds.

Changes:

  • Removes the previously commented-out DM driver import note from the default DAO generator command file.
  • Adds a new //go:build dm-guarded file that blank-imports the DM driver when the dm tag is enabled.
  • Updates cmd/gf module dependencies (go.mod/go.sum) to include the DM driver and its indirect dependencies.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
cmd/gf/internal/cmd/cmd_gen_dao.go Removes the old “do not add dm” commented guidance from the default driver import list.
cmd/gf/internal/cmd/cmd_gen_dao_dm.go Adds a dm build-tagged blank import to enable DM driver registration when requested.
cmd/gf/go.mod Adds contrib/drivers/dm/v2 and related indirect dependencies to support -tags dm builds.
cmd/gf/go.sum Records checksums for the newly introduced DM driver dependency chain.
Comments suppressed due to low confidence (1)

cmd/gf/go.mod:12

  • cmd/gf adds a direct requirement on github.com/gogf/gf/contrib/drivers/dm/v2, but the only import is behind the non-default build tag dm (see cmd_gen_dao_dm.go). Running go mod tidy without GOFLAGS=-tags=dm will typically drop this requirement/go.sum entries, which can silently break the advertised go run|install -tags dm ... flow after routine tidying (CI currently runs go mod tidy in each module without tags). Consider updating the repo’s tidy automation for cmd/gf to run with GOFLAGS=-tags=dm (or otherwise preserve tag-gated deps) so the dependency isn’t removed.
require (
	github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.10.2
	github.com/gogf/gf/contrib/drivers/dm/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

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/gf/internal/cmd/cmd_gen_dao_dm.go
@gqcn gqcn changed the title feat(cmd/gf): 支持达梦数据库驱动 feat(cmd/gf): add suppprt for dm database May 28, 2026
@gqcn gqcn changed the title feat(cmd/gf): add suppprt for dm database feat(cmd/gf): gen dao suppport for dm database May 28, 2026
@gqcn gqcn merged commit fb89f8b into master May 28, 2026
21 checks passed
@gqcn gqcn deleted the feat/tagsdm branch May 28, 2026 07:40
StrangeYear pushed a commit to StrangeYear/gf that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants