Skip to content

Commit 936a6e6

Browse files
committed
Cleaned up linter warnings
1 parent faa0572 commit 936a6e6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

internal/libraries/clamav.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func RunAntiVirus(folder string) ([]byte, error) {
6565
}
6666

6767
output := string(out)
68-
if strings.Index(output, "Infected files: 0") == -1 {
69-
return out, errors.New("Infected files found")
68+
if !strings.Contains(output, "Infected files: 0") {
69+
return out, errors.New("infected files found")
7070
}
7171

7272
return out, nil

internal/libraries/git_integration_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func TestUpdateLibraryJson(t *testing.T) {
6666
require.NoError(t, err)
6767

6868
err = gitutils.CheckoutTag(r.Repository, tag)
69+
require.NoError(t, err)
6970

7071
library, err := libraries.GenerateLibraryFromRepo(r)
7172
require.NoError(t, err)

internal/libraries/repoclone.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
package libraries
2525

2626
import (
27-
"io/ioutil"
2827
"os"
2928
"path/filepath"
3029

@@ -92,7 +91,7 @@ func CloneOrFetch(repoMeta *Repo, folderName string) (*Repository, error) {
9291

9392
// GenerateLibraryFromRepo parses a repository and returns the library metadata.
9493
func GenerateLibraryFromRepo(repo *Repository) (*metadata.LibraryMetadata, error) {
95-
bytes, err := ioutil.ReadFile(filepath.Join(repo.FolderPath, "library.properties"))
94+
bytes, err := os.ReadFile(filepath.Join(repo.FolderPath, "library.properties"))
9695
if err != nil {
9796
return nil, fmt.Errorf("can't read library.properties: %s", err)
9897
}
@@ -154,10 +153,10 @@ func BackupAndDeleteGitClone(config *configuration.Config, repoMeta *Repo) error
154153
}
155154
if gitClonePathExists {
156155
if err := backup.Backup(gitClonePath); err != nil {
157-
return fmt.Errorf("While backing up library's Git clone: %w", err)
156+
return fmt.Errorf("backing up library's Git clone: %w", err)
158157
}
159158
if err := gitClonePath.RemoveAll(); err != nil {
160-
return fmt.Errorf("While removing library Git clone: %s", err)
159+
return fmt.Errorf("removing library Git clone: %s", err)
161160
}
162161
} else {
163162
feedback.Warningf("Library Git clone folder %s not present", gitClonePath)

0 commit comments

Comments
 (0)