Explorar el Código

Prevent processing empty line at the end of file

Brendan Abolivier hace 7 años
padre
commit
55d8603b27
Firmado por: Brendan Abolivier <contact@brendanabolivier.com> ID clave GPG: 8EF1500759F70623
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4
    1
      src/metrics-alerting/config/config.go

+ 4
- 1
src/metrics-alerting/config/config.go Ver fichero

@@ -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 {