Skip to content

Commit

Permalink
Fixed vendoring bugs and golangci remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
liderman committed Apr 17, 2022
1 parent 7643ad3 commit 29c23b8
Show file tree
Hide file tree
Showing 20 changed files with 67 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.0
version: v1.45.2
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Installation
-----------
go get github.com/citilinkru/camunda-client-go
go get github.com/citilinkru/camunda-client-go/v3

Usage
-----------
Expand Down Expand Up @@ -136,7 +136,7 @@ go test -v -race ./...

Run linter:
```bash
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.42.0 golangci-lint run -v
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.45.2 golangci-lint run -v
```

Integration tests:
Expand Down
1 change: 1 addition & 0 deletions client_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package camunda_client_go
Expand Down
2 changes: 1 addition & 1 deletion examples/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"os"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion examples/history/processinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"os"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion examples/process-instance/getprocessinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

import (
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
"github.com/citilinkru/camunda-client-go/processor"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"github.com/citilinkru/camunda-client-go/v3/processor"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/start-process/start-process.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/user-task/complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"os"
"time"
)
Expand Down
25 changes: 20 additions & 5 deletions external-task.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,34 +423,49 @@ func (e *ExternalTask) FetchAndLock(query QueryFetchAndLock) ([]*ResLockedExtern

// Complete a completes an external task by id and updates process variables
func (e *ExternalTask) Complete(id string, query QueryComplete) error {
_, err := e.client.doPostJson("/external-task/"+id+"/complete", map[string]string{}, &query)
res, err := e.client.doPostJson("/external-task/"+id+"/complete", map[string]string{}, &query)
if res != nil {
res.Body.Close()
}
return err
}

// HandleBPMNError reports a business error in the context of a running external task by id.
// The error code must be specified to identify the BPMN error handler
func (e *ExternalTask) HandleBPMNError(id string, query QueryHandleBPMNError) error {
_, err := e.client.doPostJson("/external-task/"+id+"/bpmnError", map[string]string{}, &query)
res, err := e.client.doPostJson("/external-task/"+id+"/bpmnError", map[string]string{}, &query)
if res != nil {
res.Body.Close()
}
return err
}

// HandleFailure reports a failure to execute an external task by id.
// A number of retries and a timeout until the task can be retried can be specified.
// If retries are set to 0, an incident for this task is created
func (e *ExternalTask) HandleFailure(id string, query QueryHandleFailure) error {
_, err := e.client.doPostJson("/external-task/"+id+"/failure", map[string]string{}, &query)
res, err := e.client.doPostJson("/external-task/"+id+"/failure", map[string]string{}, &query)
if res != nil {
res.Body.Close()
}
return err
}

// Unlock a unlocks an external task by id. Clears the task’s lock expiration time and worker id
func (e *ExternalTask) Unlock(id string) error {
_, err := e.client.doPost("/external-task/"+id+"/unlock", map[string]string{})
res, err := e.client.doPost("/external-task/"+id+"/unlock", map[string]string{})
if res != nil {
res.Body.Close()
}
return err
}

// ExtendLock a extends the timeout of the lock by a given amount of time
func (e *ExternalTask) ExtendLock(id string, query QueryExtendLock) error {
_, err := e.client.doPostJson("/external-task/"+id+"/extendLock", map[string]string{}, &query)
res, err := e.client.doPostJson("/external-task/"+id+"/extendLock", map[string]string{}, &query)
if res != nil {
res.Body.Close()
}
return err
}

Expand Down
1 change: 1 addition & 0 deletions external-task_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package camunda_client_go
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/citilinkru/camunda-client-go
module github.com/citilinkru/camunda-client-go/v3

go 1.14

Expand Down
5 changes: 4 additions & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ type ReqMessage struct {

// SendMessage sends message to a process
func (m *Message) SendMessage(query *ReqMessage) error {
_, err := m.client.doPostJson("/message", map[string]string{}, query)
res, err := m.client.doPostJson("/message", map[string]string{}, query)
if res != nil {
res.Body.Close()
}
return err
}
5 changes: 4 additions & 1 deletion process-definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ func (p *ProcessDefinition) GetDeployedStartForm(by QueryProcessDefinitionBy) (h
// For more information about the difference between synchronous and asynchronous execution,
// please refer to the related section of the user guide
func (p *ProcessDefinition) RestartProcessInstance(id string, req ReqRestartInstance) error {
_, err := p.client.doPostJson("/process-definition/"+id+"/restart", map[string]string{}, &req)
res, err := p.client.doPostJson("/process-definition/"+id+"/restart", map[string]string{}, &req)
if res != nil {
res.Body.Close()
}
return err
}

Expand Down
15 changes: 12 additions & 3 deletions process-instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,19 @@ func (p *ProcessInstance) GetProcessVariableList(id string, query map[string]str
// ModifyProcessVariables updates or deletes the variables of a process instance by id. Updates precede deletions.
// So, if a variable is updated AND deleted, the deletion overrides the update.
func (p *ProcessInstance) ModifyProcessVariables(id string, req ReqModifyProcessVariables) error {
_, err := p.client.doPostJson("/process-instance/"+id+"/variables", nil, req)
res, err := p.client.doPostJson("/process-instance/"+id+"/variables", nil, req)
if res != nil {
res.Body.Close()
}
return err
}

// UpdateProcessVariable sets a variable of a given process instance by id.
func (p *ProcessInstance) UpdateProcessVariable(by QueryProcessInstanceVariableBy, req ReqProcessVariable) error {
_, err := p.client.doPostJson(by.String(), nil, req)
res, err := p.client.doPostJson(by.String(), nil, req)
if res != nil {
res.Body.Close()
}
return err
}

Expand Down Expand Up @@ -519,7 +525,10 @@ func (p *ProcessInstance) Get(id string) (processInstance *ResProcessInstance, e
// Instructions are executed immediately and in the order they are provided in this request's body.
// Variables can be provided with every starting instruction.
func (p *ProcessInstance) Modify(id string, req ReqModifyProcessInstance) error {
_, err := p.client.doPostJson("/process-instance/"+id+"/modification", nil, req)
res, err := p.client.doPostJson("/process-instance/"+id+"/modification", nil, req)
if res != nil {
res.Body.Close()
}
return err
}

Expand Down
2 changes: 1 addition & 1 deletion processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"runtime/debug"
"time"

camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
)

// Processor external task processor
Expand Down
3 changes: 2 additions & 1 deletion processor/processor_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//go:build integration
// +build integration

package processor

import (
"fmt"
camundaclientgo "github.com/citilinkru/camunda-client-go"
camundaclientgo "github.com/citilinkru/camunda-client-go/v3"
"github.com/stretchr/testify/assert"
"os"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion processor/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package processor

import "github.com/citilinkru/camunda-client-go"
import "github.com/citilinkru/camunda-client-go/v3"

// QueryComplete a query for Complete request
type QueryComplete struct {
Expand Down
7 changes: 5 additions & 2 deletions tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ func (p *Tenant) Create(id, name string) (err error) {
Id: id,
Name: name,
}
_, err = p.client.doPostJson("/tenant/create", map[string]string{}, &req)
return
res, err := p.client.doPostJson("/tenant/create", map[string]string{}, &req)
if res != nil {
res.Body.Close()
}
return err
}
6 changes: 5 additions & 1 deletion user-task.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,14 @@ func (t *userTaskApi) GetListCount(query *UserTaskGetListQuery) (int64, error) {

// Complete complete user task by id
func (t *userTaskApi) Complete(id string, query QueryUserTaskComplete) error {
_, err := t.client.doPostJson("/task/"+id+"/complete", map[string]string{}, query)
res, err := t.client.doPostJson("/task/"+id+"/complete", map[string]string{}, query)
if err != nil {
return fmt.Errorf("can't post json: %w", err)
}

if res != nil {
res.Body.Close()
}

return nil
}

0 comments on commit 29c23b8

Please sign in to comment.