This commit is contained in:
Michael Yang 2023-12-15 14:07:34 -08:00
parent acfc376efd
commit 2bb2bdd5d4
11 changed files with 15 additions and 15 deletions

View file

@ -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)

View file

@ -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
}

View file

@ -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() {

View file

@ -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()
}
}

View file

@ -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)

View file

@ -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

View file

@ -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)
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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)

View file

@ -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)
}