Preliminary Commit with fixes

- Sorted imports
- Fixed nested if block
- Added special nolint (goerr113) argument for error initialization
- Edited port in main.go
- Deleted swagger.json
This commit is contained in:
riabovvo committed 2020-09-02 10:33:28 +03:00
1 parent 9092acc8bf
commit abd54bf180
8 files changed
+32 -274

No files matched your search

+13 -13
View File
@@ -92,25 +92,25 @@ func expandArrayWithMapping(
arrayPath, typeFieldPath, dstKey string,
mapping map[string]string,
) {
var documents map[string][]interface{}
docs, err := src.ArrayOfObjects(arrayPath)
l := len(docs)
//nolint
if err == nil && l > 0 {
documents := make(map[string][]interface{}, l)
documents = make(map[string][]interface{}, l)
for _, d := range docs {
if docType, ok := d[typeFieldPath]; ok {
if docTypeStr, ok := docType.(string); ok {
if v, ok := mapping[docTypeStr]; ok {
putDoc(documents, v, d)
} else if v, ok := mapping[allOtherValues]; ok {
putDoc(documents, v, d)
}
}
if docType, ok := d[typeFieldPath]; !ok {
continue
} else if docTypeStr, ok := docType.(string); !ok {
continue
} else if v, ok := mapping[docTypeStr]; !ok {
putDoc(documents, v, d)
} else if v, ok := mapping[allOtherValues]; !ok {
putDoc(documents, v, d)
}
}
if len(documents) > 0 {
dst[dstKey] = documents
}
}
if len(documents) > 0 {
dst[dstKey] = documents
}
}
+4 -3
View File
@@ -3,15 +3,16 @@ package adapter_test
import (
"encoding/json"
"io/ioutil"
"log"
"os"
"testing"
"isp-script-service/adapter"
"isp-script-service/conf"
"isp-script-service/controller"
"isp-script-service/domain"
"isp-script-service/script"
"isp-script-service/service"
"log"
"os"
"testing"
"github.com/integration-system/isp-lib/v2/config"
jsoniter "github.com/json-iterator/go"