fix: satisfy release lint
This commit is contained in:
parent
33ddba59a7
commit
78e6fe75d3
@ -147,7 +147,7 @@ func (r *runtime) withStore(fn func(*store.Store) error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer st.Close()
|
||||
defer func() { _ = st.Close() }()
|
||||
return fn(st)
|
||||
}
|
||||
|
||||
@ -393,22 +393,44 @@ func (r *runtime) printProbe(report telegramdesktop.Report) error {
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(report)
|
||||
}
|
||||
fmt.Fprintf(r.stdout, "path: %s\n", report.Path)
|
||||
fmt.Fprintf(r.stdout, "exists: %t\n", report.Exists)
|
||||
fmt.Fprintf(r.stdout, "accessible: %t\n", report.Accessible)
|
||||
fmt.Fprintf(r.stdout, "store: %s\n", report.Store)
|
||||
fmt.Fprintf(r.stdout, "sqlite_files: %d\n", report.SQLiteFiles)
|
||||
fmt.Fprintf(r.stdout, "tdesktop_files: %d\n", report.TDesktopFiles)
|
||||
fmt.Fprintf(r.stdout, "files_scanned: %d\n", report.FilesScanned)
|
||||
fmt.Fprintf(r.stdout, "bytes_scanned: %d\n", report.BytesScanned)
|
||||
if _, err := fmt.Fprintf(r.stdout, "path: %s\n", report.Path); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "exists: %t\n", report.Exists); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "accessible: %t\n", report.Accessible); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "store: %s\n", report.Store); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "sqlite_files: %d\n", report.SQLiteFiles); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "tdesktop_files: %d\n", report.TDesktopFiles); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "files_scanned: %d\n", report.FilesScanned); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := fmt.Fprintf(r.stdout, "bytes_scanned: %d\n", report.BytesScanned); err != nil {
|
||||
return err
|
||||
}
|
||||
if report.AccountDirs > 0 {
|
||||
fmt.Fprintf(r.stdout, "account_dirs: %d\n", report.AccountDirs)
|
||||
if _, err := fmt.Fprintf(r.stdout, "account_dirs: %d\n", report.AccountDirs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if report.Error != "" {
|
||||
fmt.Fprintf(r.stdout, "error: %s\n", report.Error)
|
||||
if _, err := fmt.Fprintf(r.stdout, "error: %s\n", report.Error); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if report.Note != "" {
|
||||
fmt.Fprintf(r.stdout, "note: %s\n", report.Note)
|
||||
if _, err := fmt.Fprintf(r.stdout, "note: %s\n", report.Note); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ func (s *Store) ListChats(ctx context.Context, limit int, unread bool) ([]Chat,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
var out []Chat
|
||||
for rows.Next() {
|
||||
var c Chat
|
||||
@ -305,7 +305,7 @@ func (s *Store) messages(ctx context.Context, filter MessageFilter, search bool)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
var out []Message
|
||||
for rows.Next() {
|
||||
var m Message
|
||||
|
||||
@ -137,7 +137,7 @@ func sniffFile(path string) (string, bool) {
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
var header [maxProbeBytes]byte
|
||||
n, err := io.ReadFull(f, header[:])
|
||||
if err != nil && !errorsIsEOF(err) {
|
||||
@ -163,7 +163,7 @@ func isLikelyAccountDir(name string) bool {
|
||||
return false
|
||||
}
|
||||
for _, r := range name {
|
||||
if !((r >= '0' && r <= '9') || (r >= 'A' && r <= 'F')) {
|
||||
if (r < '0' || r > '9') && (r < 'A' || r > 'F') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user