From bddd8b1ba954aa17735c77cac4f688f190ac0a23 Mon Sep 17 00:00:00 2001 From: Rogee Date: Fri, 12 Sep 2025 11:05:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=B8=B8=E9=87=8F=E6=A0=BC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=BC=80=E4=BB=A5=E5=8C=BA=E5=88=86?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=EF=BC=9B=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E8=80=85=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E5=8C=85=E5=90=AB=E4=B8=BB=E9=A2=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/new_event.go | 2 +- templates/events/subscriber.go.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/new_event.go b/cmd/new_event.go index 3567481..d72702e 100644 --- a/cmd/new_event.go +++ b/cmd/new_event.go @@ -127,7 +127,7 @@ func commandNewEventE(cmd *cobra.Command, args []string) error { // 写入或追加 topic 常量,避免重复。 topicsPath := filepath.Join(baseDir, "app/events/topics.go") - topicLine := fmt.Sprintf("const Topic%s = %q\n", camelName, snakeName) + topicLine := fmt.Sprintf("const Topic%s = %q\n", camelName, "event:"+snakeName) if dryRun { fmt.Printf("[dry-run] ensure topics file and add constant > %s\n", topicsPath) diff --git a/templates/events/subscriber.go.tpl b/templates/events/subscriber.go.tpl index 7ce14c1..5ff8b0c 100644 --- a/templates/events/subscriber.go.tpl +++ b/templates/events/subscriber.go.tpl @@ -23,7 +23,7 @@ type {{.Name}}Subscriber struct { } func (e *{{.Name}}Subscriber) Prepare() error { - e.log = logrus.WithField("module", "events.subscribers.{{.Name}}Subscriber") + e.log = logrus.WithField("module", "events.subscribers.{{.Name}}Subscriber").WithField("topic", e.Topic()) return nil }