chore: enable go-critic (#5302)

* chore: enable gocritic

Signed-off-by: knqyf263 <knqyf263@gmail.com>

* refactor: fix lint issues

Signed-off-by: knqyf263 <knqyf263@gmail.com>

* test: return true for latest versions

Signed-off-by: knqyf263 <knqyf263@gmail.com>

* chore(lint): enforce map and slice styles

Signed-off-by: knqyf263 <knqyf263@gmail.com>

---------

Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Teppei Fukuda
2023-10-02 11:33:21 +03:00
committed by GitHub
parent f6cd21c873
commit 3be5e6b242
103 changed files with 584 additions and 531 deletions

View File

@@ -79,7 +79,7 @@ func (u *Updater) Update() error {
return nil
}
func Init(cacheDir string, javaDBRepository string, skip, quiet bool, registryOption ftypes.RegistryOptions) {
func Init(cacheDir, javaDBRepository string, skip, quiet bool, registryOption ftypes.RegistryOptions) {
updater = &Updater{
repo: fmt.Sprintf("%s:%d", javaDBRepository, db.SchemaVersion),
dbDir: filepath.Join(cacheDir, "java-db"),
@@ -151,7 +151,7 @@ func (d *DB) SearchByArtifactID(artifactID string) (string, error) {
// Some artifacts might have the same artifactId.
// e.g. "javax.servlet:jstl" and "jstl:jstl"
groupIDs := map[string]int{}
groupIDs := make(map[string]int)
for _, index := range indexes {
if i, ok := groupIDs[index.GroupID]; ok {
groupIDs[index.GroupID] = i + 1