simplify a couple loops
This commit is contained in:
parent
05b54687b6
commit
26faf6fb13
2 changed files with 12 additions and 17 deletions
|
@ -91,10 +91,7 @@ func truncate(values []string, contextValueLen int) (string, error) {
|
|||
return "", fmt.Errorf("unable to dump metas: %s", err)
|
||||
}
|
||||
ret = string(valueByte)
|
||||
for {
|
||||
if len(ret) <= contextValueLen {
|
||||
break
|
||||
}
|
||||
for len(ret) > contextValueLen {
|
||||
// if there is only 1 value left and that the size is too big, truncate it
|
||||
if len(values) == 1 {
|
||||
valueToTruncate := values[0]
|
||||
|
|
|
@ -380,7 +380,6 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
|
|||
bucketFactory.processors = append(bucketFactory.processors, &BayesianBucket{})
|
||||
}
|
||||
|
||||
if len(bucketFactory.Data) > 0 {
|
||||
for _, data := range bucketFactory.Data {
|
||||
if data.DestPath == "" {
|
||||
bucketFactory.logger.Errorf("no dest_file provided for '%s'", bucketFactory.Name)
|
||||
|
@ -394,7 +393,6 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
|
|||
exprhelpers.RegexpCacheInit(data.DestPath, *data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bucketFactory.output = false
|
||||
if err := ValidateFactory(bucketFactory); err != nil {
|
||||
|
|
Loading…
Reference in a new issue