Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Jan 9, 2024
1 parent acfc376 commit 2bb2bdd
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
5 changes: 1 addition & 4 deletions cmd/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions llm/ggml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
}
Expand Down
4 changes: 1 addition & 3 deletions progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -101,8 +101,6 @@ func (p *Progress) render() error {
}

p.pos = len(p.states)

return nil
}

func (p *Progress) start() {
Expand Down
4 changes: 2 additions & 2 deletions readline/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func (h *History) Add(l []rune) {
h.Compact()
h.Pos = h.Size()
if h.Autosave {
h.Save()
_ = h.Save()
}
}

Expand Down
1 change: 1 addition & 0 deletions readline/readline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion readline/readline_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion server/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -340,6 +340,7 @@ func downloadBlob(ctx context.Context, opts downloadOpts) error {
return err
}

// nolint: contextcheck
go download.Run(context.Background(), requestURL, opts.regOpts)
}

Expand Down
1 change: 1 addition & 0 deletions server/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion server/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions server/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 2bb2bdd

Please sign in to comment.