Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

more lint

Michael Yang8ce4032e7277
diff --git a/readline/buffer.go b/readline/buffer.go
index c5ac3f26e..b7cf9b13f 100644
--- a/readline/buffer.go
+++ b/readline/buffer.go
@@ -52,7 +52,6 @@ func (b *Buffer) GetLineSpacing(line int) bool {
}
return hasSpace.(bool)
-
}
func (b *Buffer) MoveLeft() {
@@ -117,15 +116,12 @@ func (b *Buffer) MoveRight() {
if b.DisplayPos%b.LineWidth == 0 {
fmt.Printf(CursorDown + CursorBOL + cursorRightN(len(b.Prompt.prompt())))
-
} else if (b.DisplayPos-rLength)%b.LineWidth == b.LineWidth-1 && hasSpace {
fmt.Printf(CursorDown + CursorBOL + cursorRightN(len(b.Prompt.prompt())+rLength))
b.DisplayPos += 1
-
} else if b.LineHasSpace.Size() > 0 && b.DisplayPos%b.LineWidth == b.LineWidth-1 && hasSpace {
fmt.Printf(CursorDown + CursorBOL + cursorRightN(len(b.Prompt.prompt())))
b.DisplayPos += 1
-
} else {
fmt.Print(cursorRightN(rLength))
}
@@ -185,7 +181,7 @@ func (b *Buffer) MoveToEnd() {
func (b *Buffer) DisplaySize() int {
sum := 0
- for i := 0; i < b.Buf.Size(); i++ {
+ for i := range b.Buf.Size() {
if e, ok := b.Buf.Get(i); ok {
if r, ok := e.(rune); ok {
sum += runewidth.RuneWidth(r)
@@ -197,7 +193,6 @@ func (b *Buffer) DisplaySize() int {
}
func (b *Buffer) Add(r rune) {
-
if b.Pos == b.Buf.Size() {
b.AddChar(r, false)
} else {
@@ -210,7 +205,6 @@ func (b *Buffer) AddChar(r rune, insert bool) {
b.DisplayPos += rLength
if b.Pos > 0 {
-
if b.DisplayPos%b.LineWidth == 0 {
fmt.Printf("%c", r)
fmt.Printf("\n%s", b.Prompt.AltPrompt)
@@ -235,7 +229,6 @@ func (b *Buffer) AddChar(r rune, insert bool) {
} else {
b.LineHasSpace.Add(true)
}
-
} else {
fmt.Printf("%c", r)
}
@@ -356,7 +349,6 @@ func (b *Buffer) drawRemaining() {
func (b *Buffer) Remove() {
if b.Buf.Size() > 0 && b.Pos > 0 {
-
if e, ok := b.Buf.Get(b.Pos - 1); ok {
if r, ok := e.(rune); ok {
rLength := runewidth.RuneWidth(r)
@@ -382,7 +374,6 @@ func (b *Buffer) Remove() {
} else {
fmt.Print(" " + CursorLeft)
}
-
} else if (b.DisplayPos-rLength)%b.LineWidth == 0 && hasSpace {
fmt.Printf(CursorBOL + ClearToEOL)
fmt.Printf(CursorUp + CursorBOL + cursorRightN(b.Width))
@@ -391,10 +382,9 @@ func (b *Buffer) Remove() {
b.LineHasSpace.Remove(b.DisplayPos/b.LineWidth - 1)
}
b.DisplayPos -= 1
-
} else {
fmt.Print(cursorLeftN(rLength))
- for i := 0; i < rLength; i++ {
+ for range rLength {
fmt.Print(" ")
}
fmt.Print(cursorLeftN(rLength))
@@ -525,7 +515,7 @@ func (b *Buffer) Replace(r []rune) {
fmt.Printf(CursorBOL + ClearToEOL)
- for i := 0; i < lineNums; i++ {
+ for range lineNums {
fmt.Print(CursorUp + CursorBOL + ClearToEOL)
}
diff --git a/server/routes_test.go b/server/routes_test.go
index 1fc258e08..79354017b 100644
--- a/server/routes_test.go
+++ b/server/routes_test.go
@@ -26,20 +26,20 @@ func createTestFile(t *testing.T, name string) string {
t.Helper()
f, err := os.CreateTemp(t.TempDir(), name)
- assert.NoError(t, err)
+ require.NoError(t, err)
defer f.Close()
err = binary.Write(f, binary.LittleEndian, []byte("GGUF"))
- assert.NoError(t, err)
+ require.NoError(t, err)
err = binary.Write(f, binary.LittleEndian, uint32(3))
- assert.NoError(t, err)
+ require.NoError(t, err)
err = binary.Write(f, binary.LittleEndian, uint64(0))
- assert.NoError(t, err)
+ require.NoError(t, err)
err = binary.Write(f, binary.LittleEndian, uint64(0))
- assert.NoError(t, err)
+ require.NoError(t, err)
return f.Name()
}