Skip to content

Bug Report: append slice all items when range it #948

Open
@alingse

Description

@alingse

I was running github actions to run linter sundrylint for top github golang repos.

see issues alingse/go-linter-runner#3

and the github actions output https://github.com/alingse/go-linter-runner/actions/runs/9273043532/job/25512239384

====================================================================================================
https://github.com/open2b/scriggo/blob/main/internal/compiler/emitter.go#L148:14: append all its data while range it
====================================================================================================
			// Do not add duplicated init functions.
			for _, pkgInit := range pkgInits {
				add := true
				for _, ini := range inits {
					if ini == pkgInit {
						add = false
						break
					}
				}
				if add {
					inits = append(inits, pkgInits...)
				}
			}

the inits = append(inits, pkgInits...) should be inits = append(inits, pkgInit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions