Pārlūkot izejas kodu

Prevent processing empty line at the end of file

Brendan Abolivier 7 gadus atpakaļ
vecāks
revīzija
55d8603b27
Parakstījis: Brendan Abolivier <contact@brendanabolivier.com> GPG atslēgas ID: 8EF1500759F70623
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4
    1
      src/metrics-alerting/config/config.go

+ 4
- 1
src/metrics-alerting/config/config.go Parādīt failu

@@ -112,7 +112,10 @@ func (cfg *Config) loadData() error {
112 112
 					break
113 113
 				}
114 114
 
115
-				script.ScriptData[key] = append(script.ScriptData[key], line)
115
+				// Prevent processing empty line at the end of file
116
+				if len(line) > 0 {
117
+					script.ScriptData[key] = append(script.ScriptData[key], line)
118
+				}
116 119
 			}
117 120
 		}
118 121
 		for key, slice := range script.DataSource.Plain {