refactor: Remove unreachable dead code branches
- parseDetail: Remove len(parts) != 2 check after SplitN(line, ":", 2) when we already verified line contains ":" (SplitN always returns 2) Function improved from 96.4% to 98.1% coverage.
This commit is contained in:
parent
a0a473ada8
commit
be23624592
1 changed files with 1 additions and 3 deletions
|
|
@ -157,10 +157,8 @@ func parseDetail(device, output string) (host.RAIDArray, error) {
|
|||
|
||||
// Parse key-value pairs
|
||||
if strings.Contains(line, ":") {
|
||||
// SplitN with n=2 always returns 2 elements when ":" exists
|
||||
parts := strings.SplitN(line, ":", 2)
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
}
|
||||
key := strings.TrimSpace(parts[0])
|
||||
value := strings.TrimSpace(parts[1])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue