Skip to content

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

fix lint

Michael Yang2bb2bdd5d41a
diff --git a/cmd/interactive.go b/cmd/interactive.go
index 0b264a69f..40cbd60db 100644
--- a/cmd/interactive.go
+++ b/cmd/interactive.go
@@ -238,10 +238,7 @@ func generateInteractive(cmd *cobra.Command, opts generateOptions) error {
usageParameters()
continue
}
- var params []string
- for _, p := range args[3:] {
- params = append(params, p)
- }
+ params := args[3:]
fp, err := api.FormatParams(map[string][]string{args[2]: params})
if err != nil {
fmt.Printf("Couldn't set parameter: %q\n\n", err)
diff --git a/llm/ggml.go b/llm/ggml.go
index 7ba42962a..ac3a39d8c 100644
--- a/llm/ggml.go
+++ b/llm/ggml.go
@@ -98,9 +98,9 @@ func (c *containerLORA) Name() string {
return "ggla"
}
-func (c *containerLORA) Decode(ro *readSeekOffset) (model, error) {
+func (c *containerLORA) Decode(rso *readSeekOffset) (model, error) {
var version uint32
- binary.Read(ro, binary.LittleEndian, &version)
+ binary.Read(rso, binary.LittleEndian, &version)
switch version {
case 1:
@@ -111,7 +111,7 @@ func (c *containerLORA) Decode(ro *readSeekOffset) (model, error) {
c.version = version
// remaining file contents aren't decoded
- ro.Seek(0, io.SeekEnd)
+ rso.Seek(0, io.SeekEnd)
return nil, nil
}
diff --git a/progress/progress.go b/progress/progress.go
index 78917e9ca..556ba00f3 100644
--- a/progress/progress.go
+++ b/progress/progress.go
@@ -77,7 +77,7 @@ func (p *Progress) Add(key string, state State) {
p.states = append(p.states, state)
}
-func (p *Progress) render() error {
+func (p *Progress) render() {
p.mu.Lock()
defer p.mu.Unlock()
@@ -101,8 +101,6 @@ func (p *Progress) render() error {
}
p.pos = len(p.states)
-
- return nil
}
func (p *Progress) start() {
diff --git a/readline/history.go b/readline/history.go
index 52c7d342c..db99fad0a 100644
--- a/readline/history.go
+++ b/readline/history.go
@@ -23,7 +23,7 @@ type History struct {
func NewHistory() (*History, error) {
h := &History{
Buf: arraylist.New(),
- Limit: 100, //resizeme
+ Limit: 100, // resizeme
Autosave: true,
Enabled: true,
}
@@ -84,7 +84,7 @@ func (h *History) Add(l []rune) {
h.Compact()
h.Pos = h.Size()
if h.Autosave {
- h.Save()
+ _ = h.Save()
}
}
diff --git a/readline/readline.go b/readline/readline.go
index ba9cf4bf7..202d9fa74 100644
--- a/readline/readline.go
+++ b/readline/readline.go
@@ -72,6 +72,7 @@ func (i *Instance) Readline() (string, error) {
if err != nil {
return "", err
}
+ // nolint: errcheck
defer UnsetRawMode(fd, termios)
buf, _ := NewBuffer(i.Prompt)
diff --git a/readline/readline_unix.go b/readline/readline_unix.go
index a1e34d278..73930c3dd 100644
--- a/readline/readline_unix.go
+++ b/readline/readline_unix.go
@@ -11,7 +11,7 @@ func handleCharCtrlZ(fd int, termios *Termios) (string, error) {
return "", err
}
- syscall.Kill(0, syscall.SIGSTOP)
+ _ = syscall.Kill(0, syscall.SIGSTOP)
// on resume...
return "", nil
diff --git a/server/download.go b/server/download.go
index d586c9cd1..cf86f994a 100644
--- a/server/download.go
+++ b/server/download.go
@@ -138,7 +138,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *Regis
}
defer file.Close()
- file.Truncate(b.Total)
+ _ = file.Truncate(b.Total)
g, inner := errgroup.WithContext(ctx)
g.SetLimit(numDownloadParts)
@@ -340,6 +340,7 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
return err
}
+ // nolint: contextcheck
go download.Run(context.Background(), requestURL, opts.regOpts)
}
diff --git a/server/images.go b/server/images.go
index 346ff5923..4742a363d 100644
--- a/server/images.go
+++ b/server/images.go
@@ -747,6 +747,7 @@ func deleteUnusedLayers(skipModelPath *ModelPath, deleteMap map[string]struct{},
// save (i.e. delete from the deleteMap) any files used in other manifests
manifest, _, err := GetManifest(fmp)
if err != nil {
+ // nolint: nilerr
return nil
}
diff --git a/server/routes.go b/server/routes.go
index fe4102d24..794c42060 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -748,6 +748,7 @@ func ListModelsHandler(c *gin.Context) {
resp, err := modelResponse(tag)
if err != nil {
log.Printf("skipping file: %s", fp)
+ // nolint: nilerr
return nil
}
diff --git a/server/routes_test.go b/server/routes_test.go
index e09648f94..aa561d980 100644
--- a/server/routes_test.go
+++ b/server/routes_test.go
@@ -193,8 +193,8 @@ func Test_Routes(t *testing.T) {
}
resp, err := httpSrv.Client().Do(req)
- defer resp.Body.Close()
assert.Nil(t, err)
+ defer resp.Body.Close()
if tc.Expected != nil {
tc.Expected(t, resp)
diff --git a/server/upload.go b/server/upload.go
index 7e8f55eae..f0852f854 100644
--- a/server/upload.go
+++ b/server/upload.go
@@ -395,6 +395,7 @@ func uploadBlob(ctx context.Context, mp ModelPath, layer *Layer, opts *RegistryO
return err
}
+ // nolint: contextcheck
go upload.Run(context.Background(), opts)
}