mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
Fix problems signaled by new linter version v1.45.2
PR (linter: upgrade linter version #405) triggered lint job which failed with many errors generated by various linters. Configurations were added to golangcilint.yaml and several refactorings were made in order to improve the results of the linter. maintidx linter disabled Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
d19a4bf2a1
commit
d325c8b5f4
@@ -27,7 +27,7 @@ type Blob struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
func NewCache(rootDir string, name string, log zlog.Logger) *Cache {
|
||||
func NewCache(rootDir, name string, log zlog.Logger) *Cache {
|
||||
dbPath := path.Join(rootDir, name+".db")
|
||||
dbOpts := &bbolt.Options{
|
||||
Timeout: dbCacheLockCheckTimeout,
|
||||
@@ -60,7 +60,7 @@ func NewCache(rootDir string, name string, log zlog.Logger) *Cache {
|
||||
return &Cache{rootDir: rootDir, db: cacheDB, log: log}
|
||||
}
|
||||
|
||||
func (c *Cache) PutBlob(digest string, path string) error {
|
||||
func (c *Cache) PutBlob(digest, path string) error {
|
||||
if path == "" {
|
||||
c.log.Error().Err(errors.ErrEmptyValue).Str("digest", digest).Msg("empty path provided")
|
||||
|
||||
@@ -136,7 +136,7 @@ func (c *Cache) GetBlob(digest string) (string, error) {
|
||||
return blobPath.String(), nil
|
||||
}
|
||||
|
||||
func (c *Cache) HasBlob(digest string, blob string) bool {
|
||||
func (c *Cache) HasBlob(digest, blob string) bool {
|
||||
if err := c.db.View(func(tx *bbolt.Tx) error {
|
||||
root := tx.Bucket([]byte(BlobsCache))
|
||||
if root == nil {
|
||||
@@ -164,7 +164,7 @@ func (c *Cache) HasBlob(digest string, blob string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Cache) DeleteBlob(digest string, path string) error {
|
||||
func (c *Cache) DeleteBlob(digest, path string) error {
|
||||
// use only relative (to rootDir) paths on blobs
|
||||
relp, err := filepath.Rel(c.rootDir, path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user