diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73ac39e..5d2798a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,22 +27,21 @@ jobs: go-version: '^1' - name: Get dependencies run: | - go get -v github.com/google/go-querystring/query - go get -v github.com/h2non/gock - go get -v github.com/joho/godotenv - go get -v github.com/retailcrm/api-client-go/errs + go mod tidy cp .env.dist .env - name: Lint code with golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.36 + version: v1.39 only-new-issues: true + skip-go-installation: true + skip-pkg-cache: true tests: name: Tests runs-on: ubuntu-latest strategy: matrix: - go-version: ['1.8', '1.9', '1.10', '1.11', '1.12', '1.13'] + go-version: ['1.11', '1.12', '1.13', '1.14', '1.15', '1.16'] include: - go-version: '1.14' coverage: 1 @@ -55,10 +54,7 @@ jobs: uses: actions/checkout@v2 - name: Get dependencies run: | - go get -v github.com/google/go-querystring/query - go get -v github.com/h2non/gock - go get -v github.com/joho/godotenv - go get -v github.com/retailcrm/api-client-go/errs + go mod tidy cp .env.dist .env - name: Tests env: diff --git a/.golangci.yml b/.golangci.yml index 5f57676..887c5ee 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -36,15 +36,12 @@ linters: - gomnd - gosec - ifshort - - interfacer - lll - makezero - - maligned - misspell - nestif - prealloc - predeclared - - scopelint - sqlclosecheck - unconvert - whitespace diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2c5d926 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module github.com/retailcrm/api-client-go + +go 1.13 + +require ( + github.com/google/go-querystring v1.1.0 + github.com/joho/godotenv v1.3.0 + gopkg.in/h2non/gock.v1 v1.0.16 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..98208cf --- /dev/null +++ b/go.sum @@ -0,0 +1,19 @@ +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/h2non/gentleman.v1 v1.0.4/go.mod h1:JYuHVdFzS4MKOXe0o+chKJ4hCe6tqKKw9XH9YP6WFrg= +gopkg.in/h2non/gock.v1 v1.0.16 h1:F11k+OafeuFENsjei5t2vMTSTs9L62AdyTe4E1cgdG8= +gopkg.in/h2non/gock.v1 v1.0.16/go.mod h1:XVuDAssexPLwgxCLMvDTWNU5eqklsydR6I5phZ9oPB8= diff --git a/v5/client.go b/v5/client.go index a918ffa..6978762 100644 --- a/v5/client.go +++ b/v5/client.go @@ -617,7 +617,7 @@ func (c *Client) CustomerNoteDelete(id int) (SuccessfulResponse, int, *errs.Fail var resp SuccessfulResponse p := url.Values{ - "id": {string(id)}, + "id": {strconv.Itoa(id)}, } data, status, err := c.PostRequest(fmt.Sprintf("/customers/notes/%d/delete", id), p) @@ -1106,7 +1106,7 @@ func (c *Client) CorporateCustomerNoteDelete(id int) (SuccessfulResponse, int, * var resp SuccessfulResponse p := url.Values{ - "id": {string(id)}, + "id": {strconv.Itoa(id)}, } data, status, err := c.PostRequest(fmt.Sprintf("/customers-corporate/notes/%d/delete", id), p) @@ -2437,7 +2437,7 @@ func (c *Client) OrderPaymentDelete(id int) (SuccessfulResponse, int, *errs.Fail var resp SuccessfulResponse p := url.Values{ - "id": {string(id)}, + "id": {strconv.Itoa(id)}, } data, status, err := c.PostRequest(fmt.Sprintf("/orders/payments/%d/delete", id), p) diff --git a/v5/client_test.go b/v5/client_test.go index 5cce145..0e132a2 100644 --- a/v5/client_test.go +++ b/v5/client_test.go @@ -15,8 +15,8 @@ import ( "testing" "time" - "github.com/h2non/gock" "github.com/joho/godotenv" + gock "gopkg.in/h2non/gock.v1" ) func TestMain(m *testing.M) { @@ -1817,7 +1817,7 @@ func TestClient_NotesCreateDelete(t *testing.T) { } p = url.Values{ - "id": {string(1)}, + "id": {"1"}, } gock.New(crmURL). @@ -1879,7 +1879,7 @@ func TestClient_NotesCreateDelete_Fail(t *testing.T) { } p = url.Values{ - "id": {string(iCodeFail)}, + "id": {strconv.Itoa(iCodeFail)}, } gock.New(crmURL). @@ -2564,7 +2564,7 @@ func TestClient_PaymentCreateEditDelete(t *testing.T) { } p = url.Values{ - "id": {string(paymentCreateResponse.ID)}, + "id": {strconv.Itoa(paymentCreateResponse.ID)}, } gock.New(crmURL). @@ -2655,7 +2655,7 @@ func TestClient_PaymentCreateEditDelete_Fail(t *testing.T) { } p = url.Values{ - "id": {string(iCodeFail)}, + "id": {strconv.Itoa(iCodeFail)}, } gock.New(crmURL).