From 9ccc1c17284748f2986791d1b28d9c58e37abe63 Mon Sep 17 00:00:00 2001 From: riabovvo Date: Tue, 1 Sep 2020 13:14:22 +0300 Subject: [PATCH 1/8] Added Swagger Documentation - Added Swagger Docs (generated docs in ./docs folder; ) - Added .golangci.yml config file --- .golangci.yml | 37 ++++++ controller/script.go | 37 ++++++ docs/docs.go | 306 +++++++++++++++++++++++++++++++++++++++++++ docs/swagger.json | 244 ++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 158 ++++++++++++++++++++++ main.go | 18 ++- 6 files changed, 796 insertions(+), 4 deletions(-) create mode 100644 .golangci.yml create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b759c73 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,37 @@ +linters: + enable-all: true + disable: + - goimports + - depguard # не используется + - gochecknoinits + - gochecknoglobals + - wsl + - gocognit + - godox # находит тудушки, не нужно + - golint # подумать, может вернуть + - stylecheck # подумать, может вернуть + +linters-settings: + maligned: + suggest-new: true + lll: + line-length: 140 + tab-width: 1 + funlen: + lines: 80 + statements: 40 + prealloc: + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # True by default. + simple: true + range-loops: true # Report preallocation suggestions on range loops, true by default + for-loops: true # Report preallocation suggestions on for loops, false by default + gocritic: + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - diagnostic + - performance + settings: + hugeParam: + sizeThreshold: 90 diff --git a/controller/script.go b/controller/script.go index 46df5b2..a26aabc 100644 --- a/controller/script.go +++ b/controller/script.go @@ -9,18 +9,55 @@ var Script scriptController type scriptController struct{} +// ExecuteById godoc +// @Tags script +// @Summary Выполнить скрипт под конкректным ID +// @Description Возвращает результат выполнения скрипта и ошибку (если есть) +// @Accept json +// @Produce json +// @Param body body domain.ExecuteByIdRequest true "Идентифиактор скрипта" +// @Success 200 {object} domain.ScriptResp +// @Failure 404 {object} structure.GrpcError +// @Router /script/execute_by_id [POST] func (c scriptController) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) { return service.Script.ExecuteById(req) } +// Execute godoc +// @Tags script +// @Summary Выполнить скрипт без учёта идентификатора +// @Description Возвращает результат выполнения скрипта и ошибку (если есть) +// @Accept json +// @Produce json +// @Param body body domain.ExecuteRequest true "Скрипт необходимый к выполнению" +// @Success 200 {object} domain.ScriptResp +// @Router /script/execute [POST] func (c scriptController) Execute(req domain.ExecuteRequest) *domain.ScriptResp { return service.Script.Execute(req) } +// BatchExecute godoc +// @Tags script +// @Summary Выполнить набор скриптов под конкретными ID +// @Description Возвращает результат выполнения скриптов и ошибок (если есть) +// @Accept json +// @Produce json +// @Param body body []domain.ExecuteByIdRequest true "Набор идентфикаторов и аргументов" +// @Success 200 {array} domain.ScriptResp +// @Router /script/batch_execute [POST] func (c scriptController) BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp { return service.Script.BatchExecute(req) } +// BatchExecuteById godoc +// @Tags script +// @Summary Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех +// @Description Возвращает результат выполнения скриптов и ошибок (если есть) +// @Accept json +// @Produce json +// @Param body body domain.BatchExecuteByIdsRequest true "Набор идентфикаторов и единый аргумент" +// @Success 200 {array} domain.ScriptResp +// @Router /script/batch_execute_by_ids [POST] func (c scriptController) BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp { return service.Script.BatchExecuteById(req) } diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..bf5c654 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,306 @@ +// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// This file was generated by swaggo/swag + +package docs + +import ( + "bytes" + "encoding/json" + "strings" + + "github.com/alecthomas/template" + "github.com/swaggo/swag" +) + +var doc = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{.Description}}", + "title": "{{.Title}}", + "contact": {}, + "license": { + "name": "GNU GPL v3.0" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/script/batch_execute": { + "post": { + "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить набор скриптов под конкретными ID", + "parameters": [ + { + "description": "Набор идентфикаторов и аргументов", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ExecuteByIdRequest" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + } + }, + "/script/batch_execute_by_ids": { + "post": { + "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех", + "parameters": [ + { + "description": "Набор идентфикаторов и единый аргумент", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.BatchExecuteByIdsRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + } + }, + "/script/execute": { + "post": { + "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить скрипт без учёта идентификатора", + "parameters": [ + { + "description": "Скрипт необходимый к выполнению", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ExecuteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + }, + "/script/execute_by_id": { + "post": { + "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить скрипт под конкректным ID", + "parameters": [ + { + "description": "Идентифиактор скрипта", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ExecuteByIdRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ScriptResp" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/structure.GrpcError" + } + } + } + } + } + }, + "definitions": { + "domain.BatchExecuteByIdsRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "domain.Error": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "domain.ExecuteByIdRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "id": { + "type": "string" + } + } + }, + "domain.ExecuteRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "script": { + "type": "string" + } + } + }, + "domain.ScriptResp": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/domain.Error" + }, + "result": { + "type": "object" + } + } + }, + "structure.GrpcError": { + "type": "object", + "properties": { + "details": { + "type": "array", + "items": { + "type": "object" + } + }, + "errorCode": { + "type": "string" + }, + "errorMessage": { + "type": "string" + } + } + } + } +}` + +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = swaggerInfo{ + Version: "1.0.0", + Host: "localhost:9024", + BasePath: "/api/script", + Schemes: []string{}, + Title: "isp-script-service", + Description: "{описание сервиса}", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() +} + +func init() { + swag.Register(swag.Name, &s{}) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..2ff6d8e --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,244 @@ +{ + "swagger": "2.0", + "info": { + "description": "{описание сервиса}", + "title": "isp-script-service", + "contact": {}, + "license": { + "name": "GNU GPL v3.0" + }, + "version": "1.0.0" + }, + "host": "localhost:9024", + "basePath": "/api/script", + "paths": { + "/script/batch_execute": { + "post": { + "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить набор скриптов под конкретными ID", + "parameters": [ + { + "description": "Набор идентфикаторов и аргументов", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ExecuteByIdRequest" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + } + }, + "/script/batch_execute_by_ids": { + "post": { + "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех", + "parameters": [ + { + "description": "Набор идентфикаторов и единый аргумент", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.BatchExecuteByIdsRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + } + }, + "/script/execute": { + "post": { + "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить скрипт без учёта идентификатора", + "parameters": [ + { + "description": "Скрипт необходимый к выполнению", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ExecuteRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ScriptResp" + } + } + } + } + }, + "/script/execute_by_id": { + "post": { + "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "script" + ], + "summary": "Выполнить скрипт под конкректным ID", + "parameters": [ + { + "description": "Идентифиактор скрипта", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ExecuteByIdRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ScriptResp" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/structure.GrpcError" + } + } + } + } + } + }, + "definitions": { + "domain.BatchExecuteByIdsRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "domain.Error": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "domain.ExecuteByIdRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "id": { + "type": "string" + } + } + }, + "domain.ExecuteRequest": { + "type": "object", + "properties": { + "arg": { + "type": "object" + }, + "script": { + "type": "string" + } + } + }, + "domain.ScriptResp": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/domain.Error" + }, + "result": { + "type": "object" + } + } + }, + "structure.GrpcError": { + "type": "object", + "properties": { + "details": { + "type": "array", + "items": { + "type": "object" + } + }, + "errorCode": { + "type": "string" + }, + "errorMessage": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..24bf88c --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,158 @@ +basePath: /api/script +definitions: + domain.BatchExecuteByIdsRequest: + properties: + arg: + type: object + ids: + items: + type: string + type: array + type: object + domain.Error: + properties: + description: + type: string + type: + type: string + type: object + domain.ExecuteByIdRequest: + properties: + arg: + type: object + id: + type: string + type: object + domain.ExecuteRequest: + properties: + arg: + type: object + script: + type: string + type: object + domain.ScriptResp: + properties: + error: + $ref: '#/definitions/domain.Error' + result: + type: object + type: object + structure.GrpcError: + properties: + details: + items: + type: object + type: array + errorCode: + type: string + errorMessage: + type: string + type: object +host: localhost:9024 +info: + contact: {} + description: '{описание сервиса}' + license: + name: GNU GPL v3.0 + title: isp-script-service + version: 1.0.0 +paths: + /script/batch_execute: + post: + consumes: + - application/json + description: Возвращает результат выполнения скриптов и ошибок (если есть) + parameters: + - description: Набор идентфикаторов и аргументов + in: body + name: body + required: true + schema: + items: + $ref: '#/definitions/domain.ExecuteByIdRequest' + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/domain.ScriptResp' + type: array + summary: Выполнить набор скриптов под конкретными ID + tags: + - script + /script/batch_execute_by_ids: + post: + consumes: + - application/json + description: Возвращает результат выполнения скриптов и ошибок (если есть) + parameters: + - description: Набор идентфикаторов и единый аргумент + in: body + name: body + required: true + schema: + $ref: '#/definitions/domain.BatchExecuteByIdsRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/domain.ScriptResp' + type: array + summary: Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех + tags: + - script + /script/execute: + post: + consumes: + - application/json + description: Возвращает результат выполнения скрипта и ошибку (если есть) + parameters: + - description: Скрипт необходимый к выполнению + in: body + name: body + required: true + schema: + $ref: '#/definitions/domain.ExecuteRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.ScriptResp' + summary: Выполнить скрипт без учёта идентификатора + tags: + - script + /script/execute_by_id: + post: + consumes: + - application/json + description: Возвращает результат выполнения скрипта и ошибку (если есть) + parameters: + - description: Идентифиактор скрипта + in: body + name: body + required: true + schema: + $ref: '#/definitions/domain.ExecuteByIdRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/domain.ScriptResp' + "404": + description: Not Found + schema: + $ref: '#/definitions/structure.GrpcError' + summary: Выполнить скрипт под конкректным ID + tags: + - script +swagger: "2.0" diff --git a/main.go b/main.go index c79d5c1..24346f5 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,11 @@ import ( "context" "os" + "isp-script-service/conf" + "isp-script-service/helper" + "isp-script-service/router" + "isp-script-service/service" + "github.com/integration-system/isp-lib/v2/backend" "github.com/integration-system/isp-lib/v2/bootstrap" "github.com/integration-system/isp-lib/v2/config/schema" @@ -12,16 +17,21 @@ import ( log "github.com/integration-system/isp-log" "github.com/integration-system/isp-log/stdcodes" "google.golang.org/grpc" - "isp-script-service/conf" - "isp-script-service/helper" - "isp-script-service/router" - "isp-script-service/service" ) var ( version = "1.0.0" ) +// @title isp-script-service +// @version 1.0.0 +// @description Сервис для обработка и выполения JavaScript скриптов + +// @license.name GNU GPL v3.0 + +// @host localhost:9024 +// @BasePath /api/script + func main() { bootstrap. ServiceBootstrap(&conf.Configuration{}, &conf.RemoteConfig{}). From 24d35e0505adc9ee5a1e1587a6a823e5172270fb Mon Sep 17 00:00:00 2001 From: riabovvo Date: Tue, 1 Sep 2020 14:22:53 +0300 Subject: [PATCH 2/8] Small Refactoring --- adapter/custom_date.go | 3 ++- adapter/custom_date_test.go | 27 ++++++++++++++------------- controller/script.go | 8 ++++---- engine_script_test.go | 28 ++++++++++++---------------- main.go | 16 ++++++++-------- router/client.go | 6 ++---- script/goja.go | 29 +++++++++-------------------- script/goja_test.go | 4 +++- service/script.go | 16 ++++++++++++---- 9 files changed, 66 insertions(+), 71 deletions(-) diff --git a/adapter/custom_date.go b/adapter/custom_date.go index 86db6b3..359dc3d 100644 --- a/adapter/custom_date.go +++ b/adapter/custom_date.go @@ -49,7 +49,7 @@ var ( } ) -func getCustomData(data map[string]interface{}, id string, version int64) map[string]interface{} { +func GetCustomData(data map[string]interface{}, id string, version int64) map[string]interface{} { jq := jsonq.NewQuery(data) m := make(map[string]interface{}, 6) @@ -94,6 +94,7 @@ func expandArrayWithMapping( ) { docs, err := src.ArrayOfObjects(arrayPath) l := len(docs) + //nolint if err == nil && l > 0 { documents := make(map[string][]interface{}, l) for _, d := range docs { diff --git a/adapter/custom_date_test.go b/adapter/custom_date_test.go index a50c1d6..fbe3229 100644 --- a/adapter/custom_date_test.go +++ b/adapter/custom_date_test.go @@ -1,8 +1,14 @@ -package adapter +package adapter_test import ( "encoding/json" "io/ioutil" + "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" @@ -10,11 +16,6 @@ import ( "github.com/integration-system/isp-lib/v2/config" jsoniter "github.com/json-iterator/go" "github.com/stretchr/testify/assert" - "isp-script-service/conf" - "isp-script-service/controller" - "isp-script-service/domain" - "isp-script-service/script" - "isp-script-service/service" ) const ( @@ -29,8 +30,10 @@ const ( scriptFile = "custom_date.js" ) -var data map[string]interface{} -var request = domain.ExecuteRequest{} +var ( + data map[string]interface{} + request = domain.ExecuteRequest{} +) func init() { config.InitRemoteConfig(&conf.RemoteConfig{}, []byte(remoteConf)) @@ -68,7 +71,7 @@ func TestCustomDate(t *testing.T) { } executeResult, _ := json.Marshal(execute.Result) - customDate := getCustomData(data, id, version) + customDate := adapter.GetCustomData(data, id, version) customDateResult, _ := json.Marshal(customDate) if !a.Equal(string(customDateResult), string(executeResult)) { @@ -78,9 +81,7 @@ func TestCustomDate(t *testing.T) { func BenchmarkGoCustomData(b *testing.B) { for i := 0; i < b.N; i++ { - _ = getCustomData(data, id, version) - //json.Marshal(customDate) - + _ = adapter.GetCustomData(data, id, version) } } @@ -134,7 +135,6 @@ func BenchmarkJsoniterJson(b *testing.B) { panic(err) } } - } func readFile(name string) ([]byte, error) { @@ -148,5 +148,6 @@ func readFile(name string) ([]byte, error) { if err != nil { return nil, err } + return obj, nil } diff --git a/controller/script.go b/controller/script.go index a26aabc..793de79 100644 --- a/controller/script.go +++ b/controller/script.go @@ -18,7 +18,7 @@ type scriptController struct{} // @Param body body domain.ExecuteByIdRequest true "Идентифиактор скрипта" // @Success 200 {object} domain.ScriptResp // @Failure 404 {object} structure.GrpcError -// @Router /script/execute_by_id [POST] +// @Router /script/execute_by_id [POST]. func (c scriptController) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) { return service.Script.ExecuteById(req) } @@ -31,7 +31,7 @@ func (c scriptController) ExecuteById(req domain.ExecuteByIdRequest) (*domain.Sc // @Produce json // @Param body body domain.ExecuteRequest true "Скрипт необходимый к выполнению" // @Success 200 {object} domain.ScriptResp -// @Router /script/execute [POST] +// @Router /script/execute [POST]. func (c scriptController) Execute(req domain.ExecuteRequest) *domain.ScriptResp { return service.Script.Execute(req) } @@ -44,7 +44,7 @@ func (c scriptController) Execute(req domain.ExecuteRequest) *domain.ScriptResp // @Produce json // @Param body body []domain.ExecuteByIdRequest true "Набор идентфикаторов и аргументов" // @Success 200 {array} domain.ScriptResp -// @Router /script/batch_execute [POST] +// @Router /script/batch_execute [POST]. func (c scriptController) BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp { return service.Script.BatchExecute(req) } @@ -57,7 +57,7 @@ func (c scriptController) BatchExecute(req []domain.ExecuteByIdRequest) []domain // @Produce json // @Param body body domain.BatchExecuteByIdsRequest true "Набор идентфикаторов и единый аргумент" // @Success 200 {array} domain.ScriptResp -// @Router /script/batch_execute_by_ids [POST] +// @Router /script/batch_execute_by_ids [POST]. func (c scriptController) BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp { return service.Script.BatchExecuteById(req) } diff --git a/engine_script_test.go b/engine_script_test.go index 1208dc2..8182942 100644 --- a/engine_script_test.go +++ b/engine_script_test.go @@ -1,4 +1,4 @@ -package main +package main_test import ( json2 "encoding/json" @@ -9,9 +9,9 @@ import ( "github.com/robertkrimen/otto" "github.com/robertkrimen/otto/parser" "github.com/stretchr/testify/assert" - "github.com/yuin/gopher-lua" + lua "github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua/parse" - "layeh.com/gopher-json" + json "layeh.com/gopher-json" ) const ( @@ -58,7 +58,7 @@ var ( }, } srcString []byte - expecting = make(map[string]interface{}, 0) + expecting = make(map[string]interface{}) ) func init() { @@ -107,7 +107,6 @@ func TestGoja(t *testing.T) { runTime := goja.New() runTime.Set("b", recordsExample) _, err := runTime.RunProgram(prog) - if err != nil { t.Fatal(err) } @@ -121,13 +120,6 @@ func TestGopherLua(t *testing.T) { l := lua.NewState() defer l.Close() - /*f, err := l.LoadString(` - println(src) - dst = src - `) - if !assert.NoError(err) { - return - }*/ b, _ := json2.Marshal(recordsExample) val, err := json.Decode(l, b) if !assert.NoError(err) { @@ -142,7 +134,10 @@ func TestGopherLua(t *testing.T) { } dst := l.GetGlobal("dst") b, err = json.Encode(dst) - m := make(map[string]interface{}, 0) + if !assert.NoError(err) { + return + } + m := make(map[string]interface{}) err = json2.Unmarshal(b, &m) if !assert.NoError(err) { return @@ -186,7 +181,6 @@ func BenchmarkGoja(b *testing.B) { runTime := goja.New() runTime.Set("b", recordsExample) _, err := runTime.RunProgram(prog) - if err != nil { return } @@ -223,12 +217,14 @@ func BenchmarkGopherLua(b *testing.B) { dst := l.GetGlobal("dst") c, err := json.Encode(dst) - m := make(map[string]interface{}, 0) + if err != nil { + panic(err) + } + m := make(map[string]interface{}) err = json2.Unmarshal(c, &m) if err != nil { panic(err) } - l.Close() } } diff --git a/main.go b/main.go index 24346f5..ef2a2d3 100644 --- a/main.go +++ b/main.go @@ -2,12 +2,11 @@ package main import ( "context" - "os" - "isp-script-service/conf" "isp-script-service/helper" "isp-script-service/router" "isp-script-service/service" + "os" "github.com/integration-system/isp-lib/v2/backend" "github.com/integration-system/isp-lib/v2/bootstrap" @@ -19,9 +18,7 @@ import ( "google.golang.org/grpc" ) -var ( - version = "1.0.0" -) +var version = "1.0.0" // @title isp-script-service // @version 1.0.0 @@ -49,6 +46,7 @@ func main() { func socketConfiguration(cfg interface{}) structure.SocketConfiguration { appConfig := cfg.(*conf.Configuration) + return structure.SocketConfiguration{ Host: appConfig.ConfigServiceAddress.IP, Port: appConfig.ConfigServiceAddress.Port, @@ -71,19 +69,21 @@ func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) { } func onLocalConfigLoad(cfg *conf.Configuration) { + //nolint + msgSize := 1024 * 1024 * 512 metric.InitProfiling(cfg.ModuleName) handlers := helper.GetAllHandlers() service := backend.GetDefaultService(cfg.ModuleName, handlers...) backend.StartBackendGrpcServer( cfg.GrpcInnerAddress, service, - grpc.MaxRecvMsgSize(1024*1024*512), - grpc.MaxSendMsgSize(1024*1024*512), + grpc.MaxRecvMsgSize(msgSize), + grpc.MaxSendMsgSize(msgSize), ) - } func routesData(localConfig interface{}) bootstrap.ModuleInfo { cfg := localConfig.(*conf.Configuration) + return bootstrap.ModuleInfo{ ModuleName: cfg.ModuleName, ModuleVersion: version, diff --git a/router/client.go b/router/client.go index e84f6a5..84e6cb4 100644 --- a/router/client.go +++ b/router/client.go @@ -8,10 +8,8 @@ import ( md "google.golang.org/grpc/metadata" ) -var ( - Client = backend.NewRxGrpcClient( - backend.WithDialOptions(grpc.WithInsecure()), - ) +var Client = backend.NewRxGrpcClient( + backend.WithDialOptions(grpc.WithInsecure()), ) func Invoke(methodPath string, request interface{}, metadata map[string]interface{}) (interface{}, error) { diff --git a/script/goja.go b/script/goja.go index 740962b..9d15ac9 100644 --- a/script/goja.go +++ b/script/goja.go @@ -2,13 +2,13 @@ package script import ( "errors" + "isp-script-service/conf" + "isp-script-service/router" "sync" "time" "github.com/dop251/goja" "github.com/integration-system/isp-lib/v2/config" - "isp-script-service/conf" - "isp-script-service/router" ) var pool = &sync.Pool{ @@ -20,6 +20,7 @@ var pool = &sync.Pool{ func initVm() *goja.Runtime { vm := goja.New() vm.Set("invoke", router.Invoke) + return vm } @@ -30,13 +31,17 @@ func (*Goja) Compile(script string) (Script, error) { if err != nil { return nil, err } + return &GojaProgram{prog: prog}, nil } +var errUnknownEngine = errors.New("unknown engine") + func (*Goja) Execute(program Script, arg interface{}) (interface{}, error) { value, ok := program.Src().(*goja.Program) + if !ok { - return nil, errors.New("unknown engine") + return nil, errUnknownEngine } vm := pool.Get().(*goja.Runtime) @@ -56,24 +61,8 @@ func (*Goja) Execute(program Script, arg interface{}) (interface{}, error) { if err != nil { return nil, err } + return res.Export(), nil - /*go func() { - result, err := vm.RunProgram(value) - if err != nil { - errorCh <- err - return - } - resultCh <- result.Export() - }() - select { - case result := <-resultCh: - return result, nil - case err := <-errorCh: - return nil, err - case <-time.After(awaitTime): - vm.Interrupt("time exceeded") - return nil, errors.New("time exceeded") - }*/ } type GojaProgram struct { diff --git a/script/goja_test.go b/script/goja_test.go index 50d1130..3d2c41c 100644 --- a/script/goja_test.go +++ b/script/goja_test.go @@ -1,4 +1,4 @@ -package script +package script_test import ( "errors" @@ -31,6 +31,7 @@ func TestGoja_AddFunction(t *testing.T) { a.Equal("string", varchar) a.Equal(0, integer) a.Equal("test", object) + return "test", nil } vm := goja.New() @@ -43,6 +44,7 @@ func TestGoja_AddFunction(t *testing.T) { a.Equal("string", varchar) a.Equal(0, integer) a.Equal("test", object) + //nolint return "test", errors.New("TEST") } vm = goja.New() diff --git a/service/script.go b/service/script.go index c347d22..9136a54 100644 --- a/service/script.go +++ b/service/script.go @@ -2,6 +2,10 @@ package service import ( "fmt" + log_code "isp-script-service/codes" + "isp-script-service/conf" + "isp-script-service/domain" + "isp-script-service/script" "sync" "sync/atomic" @@ -10,10 +14,6 @@ import ( "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - log_code "isp-script-service/codes" - "isp-script-service/conf" - "isp-script-service/domain" - "isp-script-service/script" ) var Script = &scriptService{} @@ -28,6 +28,7 @@ func (s *scriptService) ReceiveConfiguration(scriptDef []conf.ScriptDefinition) scr, err := s.Create(value.Script) if err != nil { log.Errorf(log_code.CreateScriptFromConfigError, "create script from config (number %d): %v", i, err) + continue } newStore[value.Id] = scr @@ -40,6 +41,7 @@ func (s *scriptService) Execute(req domain.ExecuteRequest) *domain.ScriptResp { if err != nil { return s.respError(err, domain.ErrorCompile) } + return s.executeScript(scr, req.Arg) } @@ -48,6 +50,7 @@ func (s *scriptService) ExecuteById(req domain.ExecuteByIdRequest) (*domain.Scri if scr == nil { return nil, status.Errorf(codes.NotFound, "not defined script for id %s", req.Id) } + return s.executeScript(scr, req.Arg), nil } @@ -67,6 +70,7 @@ func (s *scriptService) BatchExecute(req []domain.ExecuteByIdRequest) []domain.S }(i) } wg.Wait() + return response } @@ -86,12 +90,14 @@ func (s *scriptService) BatchExecuteById(req domain.BatchExecuteByIdsRequest) [] }(i) } wg.Wait() + return response } func (*scriptService) Create(scr string) (script.Script, error) { cfg := config.GetRemote().(*conf.RemoteConfig) scr = fmt.Sprintf("%s%s%s%s", cfg.SharedScript, "(function() {", scr, "})();") + return script.Default().Compile(scr) } @@ -103,6 +109,7 @@ func (s *scriptService) executeScript(scr script.Script, arg interface{}) *domai if response == nil { return s.respError(errors.New("empty answer, maybe lost return"), domain.ErrorRunTime) } + return &domain.ScriptResp{ Result: response, } @@ -113,6 +120,7 @@ func (*scriptService) respError(err error, errorType string) *domain.ScriptResp Type: errorType, Description: err.Error(), } + return &domain.ScriptResp{ Error: &respError, } From 9092acc8bf69e0c799f336227c3418b7e5a523ce Mon Sep 17 00:00:00 2001 From: riabovvo Date: Tue, 1 Sep 2020 14:41:39 +0300 Subject: [PATCH 3/8] Refactored script.go for lint rules --- service/script.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/script.go b/service/script.go index 9136a54..3ddecdb 100644 --- a/service/script.go +++ b/service/script.go @@ -101,13 +101,15 @@ func (*scriptService) Create(scr string) (script.Script, error) { return script.Default().Compile(scr) } +var errEmpty = errors.New("empty answer, maybe lost return") + func (s *scriptService) executeScript(scr script.Script, arg interface{}) *domain.ScriptResp { response, err := script.Default().Execute(scr, arg) if err != nil { return s.respError(err, domain.ErrorRunTime) } if response == nil { - return s.respError(errors.New("empty answer, maybe lost return"), domain.ErrorRunTime) + return s.respError(errEmpty, domain.ErrorRunTime) } return &domain.ScriptResp{ From abd54bf18036c0d83bd24e2c7a11fddf2defe4ce Mon Sep 17 00:00:00 2001 From: riabovvo Date: Wed, 2 Sep 2020 10:33:28 +0300 Subject: [PATCH 4/8] 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 --- adapter/custom_date.go | 26 ++-- adapter/custom_date_test.go | 7 +- docs/swagger.json | 244 ------------------------------------ engine_script_test.go | 4 +- main.go | 8 +- script/goja.go | 10 +- script/goja_test.go | 2 +- service/script.go | 5 +- 8 files changed, 32 insertions(+), 274 deletions(-) delete mode 100644 docs/swagger.json diff --git a/adapter/custom_date.go b/adapter/custom_date.go index 359dc3d..a080912 100644 --- a/adapter/custom_date.go +++ b/adapter/custom_date.go @@ -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 } } diff --git a/adapter/custom_date_test.go b/adapter/custom_date_test.go index fbe3229..fb907fc 100644 --- a/adapter/custom_date_test.go +++ b/adapter/custom_date_test.go @@ -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" diff --git a/docs/swagger.json b/docs/swagger.json deleted file mode 100644 index 2ff6d8e..0000000 --- a/docs/swagger.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "{описание сервиса}", - "title": "isp-script-service", - "contact": {}, - "license": { - "name": "GNU GPL v3.0" - }, - "version": "1.0.0" - }, - "host": "localhost:9024", - "basePath": "/api/script", - "paths": { - "/script/batch_execute": { - "post": { - "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "script" - ], - "summary": "Выполнить набор скриптов под конкретными ID", - "parameters": [ - { - "description": "Набор идентфикаторов и аргументов", - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ExecuteByIdRequest" - } - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ScriptResp" - } - } - } - } - } - }, - "/script/batch_execute_by_ids": { - "post": { - "description": "Возвращает результат выполнения скриптов и ошибок (если есть)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "script" - ], - "summary": "Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех", - "parameters": [ - { - "description": "Набор идентфикаторов и единый аргумент", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.BatchExecuteByIdsRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ScriptResp" - } - } - } - } - } - }, - "/script/execute": { - "post": { - "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "script" - ], - "summary": "Выполнить скрипт без учёта идентификатора", - "parameters": [ - { - "description": "Скрипт необходимый к выполнению", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ExecuteRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.ScriptResp" - } - } - } - } - }, - "/script/execute_by_id": { - "post": { - "description": "Возвращает результат выполнения скрипта и ошибку (если есть)", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "script" - ], - "summary": "Выполнить скрипт под конкректным ID", - "parameters": [ - { - "description": "Идентифиактор скрипта", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ExecuteByIdRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.ScriptResp" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/structure.GrpcError" - } - } - } - } - } - }, - "definitions": { - "domain.BatchExecuteByIdsRequest": { - "type": "object", - "properties": { - "arg": { - "type": "object" - }, - "ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "domain.Error": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "domain.ExecuteByIdRequest": { - "type": "object", - "properties": { - "arg": { - "type": "object" - }, - "id": { - "type": "string" - } - } - }, - "domain.ExecuteRequest": { - "type": "object", - "properties": { - "arg": { - "type": "object" - }, - "script": { - "type": "string" - } - } - }, - "domain.ScriptResp": { - "type": "object", - "properties": { - "error": { - "$ref": "#/definitions/domain.Error" - }, - "result": { - "type": "object" - } - } - }, - "structure.GrpcError": { - "type": "object", - "properties": { - "details": { - "type": "array", - "items": { - "type": "object" - } - }, - "errorCode": { - "type": "string" - }, - "errorMessage": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/engine_script_test.go b/engine_script_test.go index 8182942..6e7bd7a 100644 --- a/engine_script_test.go +++ b/engine_script_test.go @@ -134,8 +134,8 @@ func TestGopherLua(t *testing.T) { } dst := l.GetGlobal("dst") b, err = json.Encode(dst) - if !assert.NoError(err) { - return + if err != nil { + panic(err) } m := make(map[string]interface{}) err = json2.Unmarshal(b, &m) diff --git a/main.go b/main.go index ef2a2d3..bd7bf4c 100644 --- a/main.go +++ b/main.go @@ -2,11 +2,12 @@ package main import ( "context" + "os" + "isp-script-service/conf" "isp-script-service/helper" "isp-script-service/router" "isp-script-service/service" - "os" "github.com/integration-system/isp-lib/v2/backend" "github.com/integration-system/isp-lib/v2/bootstrap" @@ -26,7 +27,7 @@ var version = "1.0.0" // @license.name GNU GPL v3.0 -// @host localhost:9024 +// @host localhost:9000 // @BasePath /api/script func main() { @@ -69,8 +70,7 @@ func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) { } func onLocalConfigLoad(cfg *conf.Configuration) { - //nolint - msgSize := 1024 * 1024 * 512 + const msgSize = 1024 * 1024 * 512 metric.InitProfiling(cfg.ModuleName) handlers := helper.GetAllHandlers() service := backend.GetDefaultService(cfg.ModuleName, handlers...) diff --git a/script/goja.go b/script/goja.go index 9d15ac9..cb1123e 100644 --- a/script/goja.go +++ b/script/goja.go @@ -2,11 +2,12 @@ package script import ( "errors" - "isp-script-service/conf" - "isp-script-service/router" "sync" "time" + "isp-script-service/conf" + "isp-script-service/router" + "github.com/dop251/goja" "github.com/integration-system/isp-lib/v2/config" ) @@ -35,13 +36,12 @@ func (*Goja) Compile(script string) (Script, error) { return &GojaProgram{prog: prog}, nil } -var errUnknownEngine = errors.New("unknown engine") - func (*Goja) Execute(program Script, arg interface{}) (interface{}, error) { value, ok := program.Src().(*goja.Program) if !ok { - return nil, errUnknownEngine + //nolint:goerr113 + return nil, errors.New("unknown engine") } vm := pool.Get().(*goja.Runtime) diff --git a/script/goja_test.go b/script/goja_test.go index 3d2c41c..2c4d7aa 100644 --- a/script/goja_test.go +++ b/script/goja_test.go @@ -44,7 +44,7 @@ func TestGoja_AddFunction(t *testing.T) { a.Equal("string", varchar) a.Equal(0, integer) a.Equal("test", object) - //nolint + //nolint:goerr113 return "test", errors.New("TEST") } vm = goja.New() diff --git a/service/script.go b/service/script.go index 3ddecdb..acb98e4 100644 --- a/service/script.go +++ b/service/script.go @@ -2,12 +2,13 @@ package service import ( "fmt" + "sync" + "sync/atomic" + log_code "isp-script-service/codes" "isp-script-service/conf" "isp-script-service/domain" "isp-script-service/script" - "sync" - "sync/atomic" "github.com/integration-system/isp-lib/v2/config" log "github.com/integration-system/isp-log" From 24d03b5dbe68764e591cc77f469c9b7952dcdc90 Mon Sep 17 00:00:00 2001 From: riabovvo Date: Wed, 2 Sep 2020 11:24:11 +0300 Subject: [PATCH 5/8] Little FIX for adapter - replaced !ok to ok in if-else block --- adapter/custom_date.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/custom_date.go b/adapter/custom_date.go index a080912..d399b30 100644 --- a/adapter/custom_date.go +++ b/adapter/custom_date.go @@ -102,9 +102,9 @@ func expandArrayWithMapping( continue } else if docTypeStr, ok := docType.(string); !ok { continue - } else if v, ok := mapping[docTypeStr]; !ok { + } else if v, ok := mapping[docTypeStr]; ok { putDoc(documents, v, d) - } else if v, ok := mapping[allOtherValues]; !ok { + } else if v, ok := mapping[allOtherValues]; ok { putDoc(documents, v, d) } } From e8cc55b7ffa0d46d0e6a006506fa882373c3acd0 Mon Sep 17 00:00:00 2001 From: riabovvo Date: Wed, 2 Sep 2020 11:58:43 +0300 Subject: [PATCH 6/8] Dependency update - Updated swagger.yaml with swag v1.6.105. - Updated module isp-lib to v2.6.1 - Included to import swagger docs - Updated go.mod --- docs/docs.go | 61 +++++------------- docs/swagger.yaml | 11 +++- go.mod | 9 +-- go.sum | 155 ++++++++++++++++++++++++++++++++++++++-------- main.go | 1 + 5 files changed, 162 insertions(+), 75 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index bf5c654..46f38b5 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,15 +1,11 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag +// This file was generated by swaggo/swag at +// 2020-09-02 11:50:09.819512899 +0300 MSK m=+24.009697076 package docs import ( - "bytes" - "encoding/json" - "strings" - - "github.com/alecthomas/template" - "github.com/swaggo/swag" + "github.com/integration-system/isp-lib/v2/docs" ) var doc = `{ @@ -182,6 +178,9 @@ var doc = `{ "definitions": { "domain.BatchExecuteByIdsRequest": { "type": "object", + "required": [ + "ids" + ], "properties": { "arg": { "type": "object" @@ -207,6 +206,9 @@ var doc = `{ }, "domain.ExecuteByIdRequest": { "type": "object", + "required": [ + "id" + ], "properties": { "arg": { "type": "object" @@ -218,6 +220,9 @@ var doc = `{ }, "domain.ExecuteRequest": { "type": "object", + "required": [ + "script" + ], "properties": { "arg": { "type": "object" @@ -231,6 +236,7 @@ var doc = `{ "type": "object", "properties": { "error": { + "type": "object", "$ref": "#/definitions/domain.Error" }, "result": { @@ -258,49 +264,16 @@ var doc = `{ } }` -type swaggerInfo struct { - Version string - Host string - BasePath string - Schemes []string - Title string - Description string -} - // SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = swaggerInfo{ +var SwaggerInfo = docs.SwaggerInfo{ Version: "1.0.0", - Host: "localhost:9024", + Host: "localhost:9000", BasePath: "/api/script", Schemes: []string{}, Title: "isp-script-service", - Description: "{описание сервиса}", -} - -type s struct{} - -func (s *s) ReadDoc() string { - sInfo := SwaggerInfo - sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) - - t, err := template.New("swagger_info").Funcs(template.FuncMap{ - "marshal": func(v interface{}) string { - a, _ := json.Marshal(v) - return string(a) - }, - }).Parse(doc) - if err != nil { - return doc - } - - var tpl bytes.Buffer - if err := t.Execute(&tpl, sInfo); err != nil { - return doc - } - - return tpl.String() + Description: "Сервис для обработка и выполения JavaScript скриптов", } func init() { - swag.Register(swag.Name, &s{}) + docs.InitSwagger(SwaggerInfo, doc) } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 24bf88c..c174f22 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -8,6 +8,8 @@ definitions: items: type: string type: array + required: + - ids type: object domain.Error: properties: @@ -22,6 +24,8 @@ definitions: type: object id: type: string + required: + - id type: object domain.ExecuteRequest: properties: @@ -29,11 +33,14 @@ definitions: type: object script: type: string + required: + - script type: object domain.ScriptResp: properties: error: $ref: '#/definitions/domain.Error' + type: object result: type: object type: object @@ -48,10 +55,10 @@ definitions: errorMessage: type: string type: object -host: localhost:9024 +host: localhost:9000 info: contact: {} - description: '{описание сервиса}' + description: Сервис для обработка и выполения JavaScript скриптов license: name: GNU GPL v3.0 title: isp-script-service diff --git a/go.mod b/go.mod index fde1327..bf3ed35 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,17 @@ module isp-script-service go 1.13 require ( + github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect github.com/dlclark/regexp2 v1.2.0 // indirect github.com/dop251/goja v0.0.0-20200526165454-f1752421c432 github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect - github.com/integration-system/isp-lib/v2 v2.5.0 - github.com/integration-system/isp-log v1.1.3 + github.com/integration-system/isp-lib/v2 v2.6.1 + github.com/integration-system/isp-log v1.1.5 github.com/jmoiron/jsonq v0.0.0-20150511023944-e874b168d07e - github.com/json-iterator/go v1.1.9 + github.com/json-iterator/go v1.1.10 github.com/pkg/errors v0.9.1 github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.6.1 github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb google.golang.org/grpc v1.29.1 gopkg.in/sourcemap.v1 v1.0.5 // indirect diff --git a/go.sum b/go.sum index 9ce138b..73fcdc0 100644 --- a/go.sum +++ b/go.sum @@ -4,15 +4,27 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= +github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o= github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= +github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/aws/aws-sdk-go v1.29.9/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -21,8 +33,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/buaazp/fasthttprouter v0.1.1 h1:4oAnN0C3xZjylvZJdP35cxfclyn4TYkW6Y+DSvS+h8Q= github.com/buaazp/fasthttprouter v0.1.1/go.mod h1:h/Ap5oRVLeItGKTVBb+heQPks+HdIUtGmI4H5WCYijM= -github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU= -github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= +github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs= +github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -41,6 +53,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -60,18 +73,50 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs= +github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg= +github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.9 h1:9z9cbFuZJ7AcvOHKIY+f6Aevb4vObNDkTEyoMfO7rAc= +github.com/go-openapi/spec v0.19.9/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE= +github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-pg/pg/v9 v9.0.0-beta.14/go.mod h1:T2Sr6bpTCOr2lUqOUMiXLMJqZHSUBKk1LdgSqjwhZfA= github.com/go-pg/pg/v9 v9.0.3/go.mod h1:Tm/Q3Vt6gdQOH6TTN1H/xLlIXc+Qrka7TZ6uREtu/eA= -github.com/go-pg/pg/v9 v9.1.5/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg= +github.com/go-pg/pg/v9 v9.1.7/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg= github.com/go-pg/urlstruct v0.1.0/go.mod h1:2Nag+BIny6G/KYCkdt++ZnqU/VinzimGapKfs4kwlN0= github.com/go-pg/urlstruct v0.2.6/go.mod h1:dxENwVISWSOX+k87hDt0ueEJadD+gZWv3tHzwfmZPu8= github.com/go-pg/urlstruct v0.3.0/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg= -github.com/go-pg/urlstruct v0.4.0/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg= github.com/go-pg/zerochecker v0.1.1/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo= github.com/go-redis/redis/v8 v8.0.0-beta.2/go.mod h1:o1M7JtsgfDYyv3o+gBn/jJ1LkqpnCrmil7PSppZGBak= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= @@ -111,6 +156,7 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -141,10 +187,10 @@ github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f/go.mod h github.com/integration-system/gowsdl v1.0.0/go.mod h1:ZwTCE+Av5aQLnPj2/3PIop6mzCs1FY7jXrcWDvSjrBA= github.com/integration-system/isp-etp-go/v2 v2.1.1 h1:6LU9eE1cGVpp8HNRYu83K4hY49YlNPFd/uj3+Iog4ro= github.com/integration-system/isp-etp-go/v2 v2.1.1/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o= -github.com/integration-system/isp-lib/v2 v2.5.0 h1:Y9+x4vf+OTzmuFocGiTgl/V+dhNW3DD5GU5EQKWnweA= -github.com/integration-system/isp-lib/v2 v2.5.0/go.mod h1:slmiYHBnJllvd+zXay+HERPzb/HVakkVf+IIRCod1UA= -github.com/integration-system/isp-log v1.1.3 h1:+oLEF5fxaDUUQI4x44FGifEEFAR2ZvXusYGTD7m+87Y= -github.com/integration-system/isp-log v1.1.3/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs= +github.com/integration-system/isp-lib/v2 v2.6.1 h1:5YgjB1h5yl7QzvZxbk3a4MTWo92MJY1O535I0t54+sg= +github.com/integration-system/isp-lib/v2 v2.6.1/go.mod h1:ZGW7qQsCuELBHRBnSSDSEonPx+FxAfHiAfwsGQZzVO4= +github.com/integration-system/isp-log v1.1.5 h1:YiMx+hV2YyCTfHu5vIjtqSkRtPjr/WY9xvKsvONDVNU= +github.com/integration-system/isp-log v1.1.5/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs= github.com/integration-system/jsonschema v1.0.0 h1:Lci4sHGhOX27qCgZo5rvJ37Bjcfm+qCwU0yvw6ImEX4= github.com/integration-system/jsonschema v1.0.0/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -152,34 +198,44 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht github.com/jmoiron/jsonq v0.0.0-20150511023944-e874b168d07e h1:ZZCvgaRDZg1gC9/1xrsgaJzQUCQgniKtw0xjWywWAOE= github.com/jmoiron/jsonq v0.0.0-20150511023944-e874b168d07e/go.mod h1:+rHyWac2R9oAZwFe1wGY2HBzFJJy++RHBg1cU23NkD8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.10.4 h1:jFzIFaf586tquEB5EhzQG0HwGNSlgAJpG53G6Ss11wc= -github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg= +github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -254,12 +310,15 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.2-0.20200205151950-d13a6085d55c/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/segmentio/encoding v0.1.10/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q= -github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= @@ -278,22 +337,40 @@ github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM= +github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= +github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= +github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba h1:lUPlXKqgbqT2SVg2Y+eT9mu5wbqMnG+i/+Q9nK7C0Rs= +github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0= +github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= +github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio= +github.com/swaggo/swag v1.6.7 h1:e8GC2xDllJZr3omJkm9YfmK0Y56+rMO3cg0JBKNz09s= +github.com/swaggo/swag v1.6.7/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc= github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3 h1:COy7ekr2jBEd34npP2LvMTqk9UtiLkuvkjiJFHihlTo= github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3/go.mod h1:ehwM4AFY4byYSorQbigh79cKUOUNL3pAOz5eCAQNlGI= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= +github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.9.0 h1:hNpmUdy/+ZXYpGy0OBfm7K0UQTzb73W0T0U4iJIVrMw= -github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasthttp v1.16.0 h1:9zAqOYLl8Tuy3E5R6ckzGDJ1g8+pw15oQp2iL9Jl6gQ= +github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk= github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= @@ -304,6 +381,7 @@ github.com/vmihailenco/tagparser v0.1.0/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgq github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -327,6 +405,7 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -334,7 +413,7 @@ golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -344,9 +423,12 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -355,8 +437,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= @@ -366,42 +450,51 @@ golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200222033325-078779b8f2d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 h1:sfkvUWPNGwSV+8/fNqctR5lS2AqCSqYwXdrjCxp/dXo= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200409092240-59c9f1ba88fa h1:mQTN3ECqfsViCNBgq+A40vdwhkGykrrQlYe3mPj6BoU= -golang.org/x/sys v0.0.0-20200409092240-59c9f1ba88fa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= @@ -413,12 +506,18 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df h1:oQFmpjL+rb2xLkgPCpdGSAGDdq1geTZVvIfCMxSB/wQ= golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200826040757-bc8aaaa29e06 h1:ChBCbOHeLqK+j+znGPlWCcvx/t2PdxmyPBheVZxXbcc= +golang.org/x/tools v0.0.0-20200826040757-bc8aaaa29e06/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= @@ -452,6 +551,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= @@ -465,6 +566,10 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/main.go b/main.go index bd7bf4c..5855401 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "os" "isp-script-service/conf" + _ "isp-script-service/docs" "isp-script-service/helper" "isp-script-service/router" "isp-script-service/service" From 6bd382aec652c9beaa317293a380c868c39b61ff Mon Sep 17 00:00:00 2001 From: riabovvo Date: Wed, 2 Sep 2020 12:21:06 +0300 Subject: [PATCH 7/8] Dependency update v2 - excluded govalidator module (indirect) --- go.mod | 1 - go.sum | 2 -- 2 files changed, 3 deletions(-) diff --git a/go.mod b/go.mod index bf3ed35..362b88f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module isp-script-service go 1.13 require ( - github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect github.com/dlclark/regexp2 v1.2.0 // indirect github.com/dop251/goja v0.0.0-20200526165454-f1752421c432 github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect diff --git a/go.sum b/go.sum index 73fcdc0..3759df6 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,6 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o= github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/aws/aws-sdk-go v1.29.9/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= From aeb96013dd84ff024452b145e858263e1acf1ab2 Mon Sep 17 00:00:00 2001 From: riabovvo Date: Wed, 2 Sep 2020 12:27:31 +0300 Subject: [PATCH 8/8] Version update commit - updated CHANGELOG.md - updated version info --- .version | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 276cbf9..197c4d5 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.3.0 +2.4.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index f44ccda..dd9caa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### V2.4.0 +* added swagger docs +* updated to new isp-lib (v2.6.1) +* added golanci support ### V2.3.0 * additional batch method ### V2.2.0