Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 0bc8fd6

Browse files
committed
chore: slice loop replace
1 parent 35d9770 commit 0bc8fd6

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

‎differs/pip_diff.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ func (a PipAnalyzer) getPackages(image pkgutil.Image) (map[string]map[string]uti
5757
}
5858
if config.Config.Env != nil {
5959
paths := getPythonPaths(config.Config.Env)
60-
for _, p := range paths {
61-
pythonPaths = append(pythonPaths, p)
62-
}
60+
pythonPaths = append(pythonPaths, paths...)
6361
}
6462
pythonVersions, err := getPythonVersion(path)
6563
if err != nil {

‎util/diff_utils.go‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ func GetAdditions(a, b []string) []string {
6060
for _, opCode := range group {
6161
j1, j2 := opCode.J1, opCode.J2
6262
if opCode.Tag == 'r' || opCode.Tag == 'i' {
63-
for _, line := range b[j1:j2] {
64-
adds = append(adds, line)
65-
}
63+
adds = append(adds, b[j1:j2]...)
6664
}
6765
}
6866
}
@@ -78,9 +76,7 @@ func GetDeletions(a, b []string) []string {
7876
for _, opCode := range group {
7977
i1, i2 := opCode.I1, opCode.I2
8078
if opCode.Tag == 'r' || opCode.Tag == 'd' {
81-
for _, line := range a[i1:i2] {
82-
dels = append(dels, line)
83-
}
79+
dels = append(dels, a[i1:i2]...)
8480
}
8581
}
8682
}
@@ -96,9 +92,7 @@ func GetMatches(a, b []string) []string {
9692
if i != len(matchindexes)-1 {
9793
start := match.A
9894
end := match.A + match.Size
99-
for _, line := range a[start:end] {
100-
matches = append(matches, line)
101-
}
95+
matches = append(matches, a[start:end]...)
10296
}
10397
}
10498
return matches

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /