From c04abd6530cbb30e2b682b364da7df3c205ce1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Mon, 12 Oct 2026 00:10:31 +0800 Subject: [PATCH] =?UTF-8?q?style(go):=20=E6=B8=85=E6=8E=89=E5=AD=98?= =?UTF-8?q?=E9=87=8F=20gofmt=EF=BC=886=20=E4=B8=AA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5=E5=AF=B9=E9=BD=90=E4=B8=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9C=AB=E5=B0=BE=E6=8D=A2=E8=A1=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 接入格式门禁前先量了一次存量:gofmt -l 在 295 个被跟踪的 .go 文件里报 6 个, 全是字段对齐与缺文件末尾换行这类机械问题。先一次性清干净,门禁接上后 Go 侧一条都不欠。 为什么独立一个提交:格式清理混进功能改动会让 diff 无法 review(正本要求存量清理独立提交)。 验证:gofmt -l 对被跟踪的 .go 文件输出为空;go vet 与 go test 全过。 --- cmd/api/main.go | 2 +- internal/httpapi/dingtalk_discovery.go | 2 +- internal/httpapi/server.go | 6 +++--- .../postgres/catalog_scan_progress_integration_test.go | 2 +- internal/version/version.go | 2 +- internal/version/version_test.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/api/main.go b/cmd/api/main.go index 4c8ba45..097fe1e 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -138,7 +138,7 @@ func run(ctx context.Context, getenv func(string) string) error { ProductionReleaseAuthorizationToken: releaseAuthorizationToken, // 数据源发现(系统设置 → 数据源配置):用与 worker 同一份 dws 状态做只读列举。 DingtalkSources: dingtalkSourceLister{}, - BackupSchedule: postgresstore.NewStore(pool), + BackupSchedule: postgresstore.NewStore(pool), BackupHost: backuphost.New(backuphost.Config{ SSHConfig: config.BackupHostSSHConfig, Target: config.BackupHostTarget, diff --git a/internal/httpapi/dingtalk_discovery.go b/internal/httpapi/dingtalk_discovery.go index 94a9e0b..f988ebe 100644 --- a/internal/httpapi/dingtalk_discovery.go +++ b/internal/httpapi/dingtalk_discovery.go @@ -47,4 +47,4 @@ func listDingtalkSources(w http.ResponseWriter, r *http.Request, config Config) return } writeJSON(w, http.StatusOK, map[string]any{"data": result}) -} \ No newline at end of file +} diff --git a/internal/httpapi/server.go b/internal/httpapi/server.go index a10064f..862cc5a 100644 --- a/internal/httpapi/server.go +++ b/internal/httpapi/server.go @@ -128,9 +128,9 @@ type Config struct { ProductionReleaseAuthorizationToken string // DingtalkSources 枚举「我账号下能看到」的钉钉知识库与钉盘空间(只读,dws)。 // 未接线时对应路由返回 501,页面显示"列不出来"而不是空列表。 - DingtalkSources dingtalkSourcesLister - NewID func() (string, error) - Auth *AuthConfig + DingtalkSources dingtalkSourcesLister + NewID func() (string, error) + Auth *AuthConfig } func NewHandler(config Config) (http.Handler, error) { diff --git a/internal/platform/postgres/catalog_scan_progress_integration_test.go b/internal/platform/postgres/catalog_scan_progress_integration_test.go index f24b44e..f6a51ca 100644 --- a/internal/platform/postgres/catalog_scan_progress_integration_test.go +++ b/internal/platform/postgres/catalog_scan_progress_integration_test.go @@ -82,4 +82,4 @@ VALUES('conn-head','snap-head',now());`); err != nil { if item.StartedAt.IsZero() { t.Fatal("started_at should carry the scan start so the page can show a time") } -} \ No newline at end of file +} diff --git a/internal/version/version.go b/internal/version/version.go index df56e81..e82daa2 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -25,4 +25,4 @@ var ( Number = "dev" CommitSHA = "unknown" BuildTime = "unknown" -) \ No newline at end of file +) diff --git a/internal/version/version_test.go b/internal/version/version_test.go index f9a602e..fb3173b 100644 --- a/internal/version/version_test.go +++ b/internal/version/version_test.go @@ -37,4 +37,4 @@ func TestNumberMatchesChangelog(t *testing.T) { "常见原因:改了 CHANGELOG 却没重新构建(产物还报旧号),"+ "或者构建时手填了一个 CHANGELOG 里没有的号", Number, want) } -} \ No newline at end of file +}