Fix output-stdout

This commit is contained in:
Leonid Bugaev
2016-05-23 18:05:09 +05:00
parent bf13dc59c3
commit a181b144d7
+7 -4
View File
@@ -36,6 +36,7 @@ func extractLimitOptions(options string) (string, string) {
//
// See this article if curious about relfect stuff below: http://blog.burntsushi.net/type-parametric-functions-golang
func registerPlugin(constructor interface{}, options ...interface{}) {
var path, limit string
vc := reflect.ValueOf(constructor)
// Pre-processing options to make it work with reflect
@@ -44,11 +45,13 @@ func registerPlugin(constructor interface{}, options ...interface{}) {
vo = append(vo, reflect.ValueOf(oi))
}
// Removing limit options from path
path, limit := extractLimitOptions(vo[0].String())
if len(vo) > 0 {
// Removing limit options from path
path, limit = extractLimitOptions(vo[0].String())
// Writing value back without limiter "|" options
vo[0] = reflect.ValueOf(path)
// Writing value back without limiter "|" options
vo[0] = reflect.ValueOf(path)
}
// Calling our constructor with list of given options
plugin := vc.Call(vo)[0].Interface()