Apply go fix stringsseq rewrites to platform-specific check files
Replace strings.Split + for-range-slice with strings.SplitSeq + for-range-iterator in checks_linux.go and checks_windows.go. These files are invisible to go fix on macOS (darwin build tag), so the CI Linux runner caught them first. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -126,7 +126,7 @@ func windowsScreenLock(ctx context.Context) Result {
|
||||
func parseWindowsUserScreenLock(s string) (map[string]string, bool, bool) {
|
||||
users := map[string]string{}
|
||||
var anyEnabled, anyDisabled bool
|
||||
for _, line := range strings.Split(s, "\n") {
|
||||
for line := range strings.SplitSeq(s, "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
@@ -205,7 +205,7 @@ func parseWindowsFirewallProfiles(s string) (map[string]string, bool) {
|
||||
profiles := map[string]string{}
|
||||
allEnabled := true
|
||||
any := false
|
||||
for _, profile := range strings.Split(s, ";") {
|
||||
for profile := range strings.SplitSeq(s, ";") {
|
||||
parts := strings.SplitN(strings.TrimSpace(profile), "=", 2)
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
@@ -230,7 +230,7 @@ func parseWindowsFirewallProfiles(s string) (map[string]string, bool) {
|
||||
func parseNetshFirewallStates(s string) ([]string, bool) {
|
||||
var states []string
|
||||
anyOff := false
|
||||
for _, line := range strings.Split(s, "\n") {
|
||||
for line := range strings.SplitSeq(s, "\n") {
|
||||
trimmed := strings.TrimSpace(line)
|
||||
lower := strings.ToLower(trimmed)
|
||||
if !strings.HasPrefix(lower, "state") {
|
||||
|
||||
Reference in New Issue
Block a user