Skip to content

Commit 444ab06

Browse files
authored
Merge pull request #39 from werf/fix-update-all-dependencies
fix: update all modules and reformat
2 parents f85d532 + 79e3590 commit 444ab06

File tree

20 files changed

+308
-701
lines changed

20 files changed

+308
-701
lines changed

.golangci.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
run:
2+
timeout: 10m
3+
skip-dirs:
4+
- playground
5+
6+
linters-settings:
7+
gofumpt:
8+
extra-rules: true
9+
gci:
10+
sections:
11+
- standard
12+
- default
13+
- prefix(github.com/werf/)
14+
gocritic:
15+
disabled-checks:
16+
- ifElseChain
17+
errorlint:
18+
comparison: false
19+
asserts: false
20+
21+
linters:
22+
disable-all: true
23+
enable:
24+
# Default linters.
25+
- deadcode
26+
- ineffassign
27+
- structcheck
28+
- typecheck
29+
- varcheck
30+
31+
# Extra linters.
32+
- asciicheck
33+
- bidichk
34+
- bodyclose
35+
- errname
36+
- errorlint
37+
- exportloopref
38+
- gci
39+
- gocritic
40+
- gofumpt
41+
- misspell
42+

go.mod

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,74 @@
11
module github.com/werf/lockgate
22

3-
go 1.14
3+
go 1.20
44

55
require (
6-
github.com/gofrs/flock v0.7.1
7-
github.com/google/uuid v1.1.2
6+
github.com/gofrs/flock v0.8.1
7+
github.com/google/uuid v1.3.0
88
github.com/spaolacci/murmur3 v1.1.0
9-
github.com/werf/kubedog v0.6.2
10-
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
11-
k8s.io/apimachinery v0.20.4
12-
k8s.io/client-go v0.20.4
9+
github.com/werf/kubedog v0.9.10
10+
golang.org/x/crypto v0.7.0
11+
k8s.io/apimachinery v0.26.2
12+
k8s.io/client-go v0.26.2
13+
)
14+
15+
require (
16+
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
17+
github.com/avelino/slugify v0.0.0-20180501145920-855f152bd774 // indirect
18+
github.com/davecgh/go-spew v1.1.1 // indirect
19+
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
20+
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
21+
github.com/go-errors/errors v1.0.1 // indirect
22+
github.com/go-logr/logr v1.2.3 // indirect
23+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
24+
github.com/go-openapi/jsonreference v0.20.2 // indirect
25+
github.com/go-openapi/swag v0.22.3 // indirect
26+
github.com/gogo/protobuf v1.3.2 // indirect
27+
github.com/golang/protobuf v1.5.2 // indirect
28+
github.com/google/btree v1.0.1 // indirect
29+
github.com/google/gnostic v0.6.9 // indirect
30+
github.com/google/go-cmp v0.5.9 // indirect
31+
github.com/google/gofuzz v1.2.0 // indirect
32+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
33+
github.com/gookit/color v1.5.2 // indirect
34+
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
35+
github.com/imdario/mergo v0.3.13 // indirect
36+
github.com/inconshreveable/mousetrap v1.0.1 // indirect
37+
github.com/josharian/intern v1.0.0 // indirect
38+
github.com/json-iterator/go v1.1.12 // indirect
39+
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
40+
github.com/mailru/easyjson v0.7.7 // indirect
41+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
42+
github.com/modern-go/reflect2 v1.0.2 // indirect
43+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
44+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
45+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
46+
github.com/pkg/errors v0.9.1 // indirect
47+
github.com/spf13/cobra v1.6.1 // indirect
48+
github.com/spf13/pflag v1.0.5 // indirect
49+
github.com/werf/logboek v0.5.4 // indirect
50+
github.com/xlab/treeprint v1.1.0 // indirect
51+
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
52+
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
53+
golang.org/x/net v0.8.0 // indirect
54+
golang.org/x/oauth2 v0.5.0 // indirect
55+
golang.org/x/sys v0.6.0 // indirect
56+
golang.org/x/term v0.6.0 // indirect
57+
golang.org/x/text v0.8.0 // indirect
58+
golang.org/x/time v0.3.0 // indirect
59+
google.golang.org/appengine v1.6.7 // indirect
60+
google.golang.org/protobuf v1.28.1 // indirect
61+
gopkg.in/inf.v0 v0.9.1 // indirect
62+
gopkg.in/yaml.v2 v2.4.0 // indirect
63+
gopkg.in/yaml.v3 v3.0.1 // indirect
64+
k8s.io/api v0.26.2 // indirect
65+
k8s.io/cli-runtime v0.26.2 // indirect
66+
k8s.io/klog/v2 v2.90.1 // indirect
67+
k8s.io/kube-openapi v0.0.0-20230217203603-ff9a8e8fa21d // indirect
68+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
69+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
70+
sigs.k8s.io/kustomize/api v0.12.1 // indirect
71+
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
72+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
73+
sigs.k8s.io/yaml v1.3.0 // indirect
1374
)

go.sum

Lines changed: 175 additions & 657 deletions
Large diffs are not rendered by default.

pkg/distributed_locker/distributed_locker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (l *DistributedLocker) leaseRenewWorker(handle lockgate.LockHandle, opts lo
136136
}
137137

138138
if !l.isLeaseRenewWorkerActive(handle) {
139-
debug("(leaseRenewWorker %q %q) already stopped, ignore check")
139+
debug("(leaseRenewWorker %q %q) already stopped, ignore check", handle.LockName, handle.UUID)
140140
continue
141141
}
142142

pkg/distributed_locker/distributed_locker_backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"errors"
55
"time"
66

7-
"github.com/werf/lockgate"
8-
97
"github.com/google/uuid"
8+
9+
"github.com/werf/lockgate"
1010
)
1111

1212
const (

pkg/distributed_locker/factory.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package distributed_locker
22

33
import (
4-
"github.com/werf/lockgate/pkg/distributed_locker/optimistic_locking_store"
54
"k8s.io/apimachinery/pkg/runtime/schema"
65
"k8s.io/client-go/dynamic"
6+
7+
"github.com/werf/lockgate/pkg/distributed_locker/optimistic_locking_store"
78
)
89

9-
func NewKubernetesLocker(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName string, namespace string) *DistributedLocker {
10+
func NewKubernetesLocker(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName, namespace string) *DistributedLocker {
1011
store := optimistic_locking_store.NewKubernetesResourceAnnotationsStore(kubernetesInterface, gvr, resourceName, namespace)
1112
backend := NewOptimisticLockingStorageBasedBackend(store)
1213
return NewDistributedLocker(backend)
@@ -23,7 +24,7 @@ func NewHttpBackendHandlerWithInMemoryStore() *HttpBackendHandler {
2324
return NewHttpBackendHandler(backend)
2425
}
2526

26-
func NewHttpBackendHandlerWithKubernetesStore(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName string, namespace string) *HttpBackendHandler {
27+
func NewHttpBackendHandlerWithKubernetesStore(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName, namespace string) *HttpBackendHandler {
2728
store := optimistic_locking_store.NewKubernetesResourceAnnotationsStore(kubernetesInterface, gvr, resourceName, namespace)
2829
backend := NewOptimisticLockingStorageBasedBackend(store)
2930
return NewHttpBackendHandler(backend)

pkg/distributed_locker/http_backend.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"net/http"
66

77
"github.com/werf/lockgate"
8-
98
"github.com/werf/lockgate/pkg/util"
109
)
1110

@@ -22,7 +21,7 @@ func NewHttpBackend(urlEndpoint string) *HttpBackend {
2221
}
2322

2423
func (backend *HttpBackend) Acquire(lockName string, opts AcquireOptions) (lockgate.LockHandle, error) {
25-
var request = AcquireRequest{
24+
request := AcquireRequest{
2625
LockName: lockName,
2726
Opts: opts,
2827
}
@@ -35,7 +34,7 @@ func (backend *HttpBackend) Acquire(lockName string, opts AcquireOptions) (lockg
3534
}
3635

3736
func (backend *HttpBackend) RenewLease(handle lockgate.LockHandle) error {
38-
var request = RenewLeaseRequest{LockHandle: handle}
37+
request := RenewLeaseRequest{LockHandle: handle}
3938
var response RenewLeaseResponse
4039

4140
if err := util.PerformHttpPost(backend.HttpClient, fmt.Sprintf("%s/%s", backend.URLEndpoint, "renew-lease"), request, &response); err != nil {
@@ -45,7 +44,7 @@ func (backend *HttpBackend) RenewLease(handle lockgate.LockHandle) error {
4544
}
4645

4746
func (backend *HttpBackend) Release(handle lockgate.LockHandle) error {
48-
var request = ReleaseRequest{LockHandle: handle}
47+
request := ReleaseRequest{LockHandle: handle}
4948
var response ReleaseResponse
5049

5150
if err := util.PerformHttpPost(backend.HttpClient, fmt.Sprintf("%s/%s", backend.URLEndpoint, "release"), request, &response); err != nil {

pkg/distributed_locker/http_backend_handler.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"net/http"
66

77
"github.com/werf/lockgate"
8-
98
"github.com/werf/lockgate/pkg/util"
109
)
1110

pkg/distributed_locker/optimistic_locking_storage_base_backend.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"time"
77

88
"github.com/werf/lockgate"
9-
109
"github.com/werf/lockgate/pkg/distributed_locker/optimistic_locking_store"
1110
"github.com/werf/lockgate/pkg/util"
1211
)

pkg/distributed_locker/optimistic_locking_store/kubernetes_resource_annotations_store.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"strings"
77

88
"k8s.io/apimachinery/pkg/api/errors"
9-
109
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1110
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1211
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -20,7 +19,7 @@ type KubernetesResourceAnnotationsStore struct {
2019
Namespace string
2120
}
2221

23-
func NewKubernetesResourceAnnotationsStore(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName string, namespace string) *KubernetesResourceAnnotationsStore {
22+
func NewKubernetesResourceAnnotationsStore(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, resourceName, namespace string) *KubernetesResourceAnnotationsStore {
2423
return &KubernetesResourceAnnotationsStore{
2524
KubernetesInterface: kubernetesInterface,
2625
GVR: gvr,

0 commit comments

Comments
 (0)