From e42d7f6ddc0d95852df334c79df73a720dfeab40 Mon Sep 17 00:00:00 2001 From: garrettladley Date: Mon, 4 Nov 2024 11:12:23 -0500 Subject: [PATCH] fix: gofumpt --- cmd/snips/generatecmd/watcher/watch_test.go | 1 - cmd/snips/sloghandler/handler.go | 1 + generator/generator.go | 2 ++ package_test.go | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/snips/generatecmd/watcher/watch_test.go b/cmd/snips/generatecmd/watcher/watch_test.go index 0a15c27..c44d90c 100644 --- a/cmd/snips/generatecmd/watcher/watch_test.go +++ b/cmd/snips/generatecmd/watcher/watch_test.go @@ -32,5 +32,4 @@ func TestShouldIncludeFile(t *testing.T) { } }) } - } diff --git a/cmd/snips/sloghandler/handler.go b/cmd/snips/sloghandler/handler.go index 289405d..323e240 100644 --- a/cmd/snips/sloghandler/handler.go +++ b/cmd/snips/sloghandler/handler.go @@ -24,6 +24,7 @@ var levelToIcon = map[slog.Level]string{ slog.LevelWarn: "(!)", slog.LevelError: "(✗)", } + var levelToColor = map[slog.Level]*color.Color{ slog.LevelDebug: color.New(color.FgCyan), slog.LevelInfo: color.New(color.FgGreen), diff --git a/generator/generator.go b/generator/generator.go index 0618b62..91b348e 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -102,6 +102,7 @@ func (g *generator) writeCodeGeneratedComment() (err error) { _, err = g.w.Write("// Code generated by snips - DO NOT EDIT.\n\n") return err } + func (g *generator) writeVersionComment() (err error) { if g.version != "" { _, err = g.w.Write("// snips: version: " + g.version + "\n") @@ -115,6 +116,7 @@ func (g *generator) writeGeneratedDateComment() (err error) { } return err } + func (g *generator) writePackage() error { // package ... _, err := g.w.Write("package snips") diff --git a/package_test.go b/package_test.go index 98543e7..432cdd7 100644 --- a/package_test.go +++ b/package_test.go @@ -55,10 +55,10 @@ func createTempDir(t *testing.T) string { func createTempFile(t *testing.T, path, content string) { t.Helper() - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { t.Fatal(err) } - if err := os.WriteFile(path, []byte(content), 0644); err != nil { + if err := os.WriteFile(path, []byte(content), 0o644); err != nil { t.Fatal(err) } }