From 84c0423128a8ff63eec5401670842254a650970e Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Fri, 6 Sep 2024 11:09:54 -0300 Subject: [PATCH] chore: fmt Signed-off-by: Carlos Alexandro Becker --- draw.go | 18 ++++++++++++------ lexer/lexer.go | 2 +- themes.go | 13 ++++++------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/draw.go b/draw.go index 8bda6efe7..366d4e3b9 100644 --- a/draw.go +++ b/draw.go @@ -15,8 +15,10 @@ type circle struct { r int } -const white = 0xFF -const black = 0x17 +const ( + white = 0xFF + black = 0x17 +) func (c *circle) ColorModel() color.Model { return color.AlphaModel @@ -31,8 +33,10 @@ func (c *circle) Bounds() image.Rectangle { ) } -const halfPixel = 0.5 -const doublingFactor = 2 +const ( + halfPixel = 0.5 + doublingFactor = 2 +) func double(i int) int { return i * doublingFactor } func half(i int) int { return i / doublingFactor } @@ -224,8 +228,10 @@ func MakeWindowBar(termWidth, termHeight int, opts StyleOptions, file string) { } } -const barToDotRatio = 6 -const barToDotBorderRatio = 5 +const ( + barToDotRatio = 6 + barToDotBorderRatio = 5 +) func makeColorfulBar(termWidth int, termHeight int, isRight bool, opts StyleOptions, targetpng string) error { // Radius of dots diff --git a/lexer/lexer.go b/lexer/lexer.go index 78a827ec2..d8fc434b1 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -31,7 +31,7 @@ func (l *Lexer) readChar() { func (l *Lexer) NextToken() token.Token { l.skipWhitespace() - var tok = token.Token{Line: l.line, Column: l.column} + tok := token.Token{Line: l.line, Column: l.column} switch l.ch { case 0: diff --git a/themes.go b/themes.go index 493729c96..a78434d61 100644 --- a/themes.go +++ b/themes.go @@ -11,14 +11,15 @@ package main import ( - "github.com/charmbracelet/glamour/ansi" - - _ "embed" "encoding/json" "fmt" "sort" "strings" + "github.com/charmbracelet/glamour/ansi" + + _ "embed" + "github.com/agnivade/levenshtein" ) @@ -118,10 +119,8 @@ func boolPtr(b bool) *bool { return &b } func stringPtr(s string) *string { return &s } func uintPtr(u uint) *uint { return &u } -var ( - //go:embed themes.json - themesBts []byte -) +//go:embed themes.json +var themesBts []byte // ThemeNotFoundError is returned when a requested theme is not found. type ThemeNotFoundError struct {