Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/detail/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ func (v *Version) Ok() bool {
// inRangeInterval 判断一个版本是否在一个版本范围内
func inRangeInterval(ver *Version, interval string) bool {
// 遍历所有范围
for _, interval := range strings.Split(interval, "||") {
for interval := range strings.SplitSeq(interval, "||") {
if len(interval) < 2 {
continue
}
// 集合形式
if interval[0] == '{' && interval[len(interval)-1] == '}' {
for _, v := range strings.Split(strings.Trim(interval, "{}"), ",") {
for v := range strings.SplitSeq(strings.Trim(interval, "{}"), ",") {
if newVersion(v).Equal(ver) {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/format/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type TaskInfo struct {
}

func Save(report Report, output string) {
for _, out := range strings.Split(output, ",") {
for out := range strings.SplitSeq(output, ",") {
logs.Infof("result save to %s", out)
switch filepath.Ext(out) {
case ".html":
Expand Down
2 changes: 1 addition & 1 deletion opensca/sca/groovy/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (v Variable) Scan(file *model.File) {
if object == "" {
continue
}
for _, line := range strings.Split(text[bi[1]:end], "\n") {
for line := range strings.SplitSeq(text[bi[1]:end], "\n") {
match := varReg.FindStringSubmatch(line)
if len(match) == 3 {
if object == "ext" {
Expand Down
2 changes: 1 addition & 1 deletion opensca/sca/javascript/yarn.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ParseYarnLock(file *model.File) map[string]*YarnLock {

if !strings.HasPrefix(line, " ") && strings.HasSuffix(line, ":") {
lastDep = &YarnLock{Dependencies: map[string]string{}}
for _, tag := range strings.Split(line, ",") {
for tag := range strings.SplitSeq(line, ",") {
i := strings.LastIndex(tag, "@")
if i == -1 {
logs.Warnf("parse file %s line: %s fail", file.Relpath(), line)
Expand Down
4 changes: 2 additions & 2 deletions opensca/sca/php/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func FindMaxVersion(version string, versions []string) string {
s = strings.TrimLeft(strings.TrimSpace(s), "vV")
// 将 ~x[.x](php范围约束) 替换为 ^x[.x](semver范围约束)
var fix []string
for _, sub := range strings.Split(s, ",") {
for sub := range strings.SplitSeq(s, ",") {
if strings.Contains(sub, "~") && strings.Count(sub, ".") < 2 {
sub = strings.ReplaceAll(sub, "~", "^")
}
Expand All @@ -243,7 +243,7 @@ func FindMaxVersion(version string, versions []string) string {
return strings.Join(fix, ",")
}
var cs []*semver.Constraints
for _, v := range strings.Split(version, "|") {
for v := range strings.SplitSeq(version, "|") {
c, err := semver.NewConstraint(fix(v))
if err == nil {
cs = append(cs, c)
Expand Down
2 changes: 1 addition & 1 deletion opensca/sca/php/sca.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ loop:
}

// vendor中的composer.json没有对应lock则不做处理
for _, dir := range strings.Split(dir, "/") {
for dir := range strings.SplitSeq(dir, "/") {
if strings.EqualFold(dir, "vendor") {
continue loop
}
Expand Down