Skip to content

Commit

Permalink
Fix file locking issue on Windows (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
anujc25 committed Aug 14, 2024
1 parent af660c8 commit 72f0913
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/vmware-tanzu/carvel-ytt v0.40.0
github.com/vmware-tanzu/tanzu-cli/test/e2e/framework v0.0.0-00010101000000-000000000000
github.com/vmware-tanzu/tanzu-framework/capabilities/client v0.0.0-20230523145612-1c6fbba34686
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2
go.pinniped.dev v0.20.0
golang.org/x/mod v0.15.0
golang.org/x/oauth2 v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ github.com/vmware-tanzu/tanzu-framework/apis/run v0.0.0-20230419030809-7081502eb
github.com/vmware-tanzu/tanzu-framework/apis/run v0.0.0-20230419030809-7081502ebf68/go.mod h1:e1Uef+Ux5BIHpYwqbeP2ZZmOzehBcez2vUEWXHe+xHE=
github.com/vmware-tanzu/tanzu-framework/capabilities/client v0.0.0-20230523145612-1c6fbba34686 h1:VcuXqUXFxm5WDqWkzAlU/6cJXua0ozELnqD59fy7J6E=
github.com/vmware-tanzu/tanzu-framework/capabilities/client v0.0.0-20230523145612-1c6fbba34686/go.mod h1:AFGOXZD4tH+KhpmtV0VjWjllXhr8y57MvOsIxTtywc4=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1 h1:m1LVcHFTcY98hZl0TlE07VPDu/8H1DKyFW8cEVG75+c=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2 h1:XP1qkOi0JZb+itemznercMK+vw5BIuta9lUtmFp8l8U=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/xanzy/go-gitlab v0.83.0 h1:37p0MpTPNbsTMKX/JnmJtY8Ch1sFiJzVF342+RvZEGw=
github.com/xanzy/go-gitlab v0.83.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
Expand Down
4 changes: 2 additions & 2 deletions pkg/telemetry/metrics_db_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func ReleaseTanzuMetricDBLock() {
if cliMetricDBLock == nil {
return
}
if errUnlock := cliMetricDBLock.Unlock(); errUnlock != nil {
if errUnlock := cliMetricDBLock.Close(); errUnlock != nil {
panic(fmt.Sprintf("cannot release lock for Tanzu CLI metrics DB, reason: %v", errUnlock))
}

Expand Down Expand Up @@ -87,7 +87,7 @@ func getFileLockWithTimeout(lockPath string, lockDuration time.Duration) (*filem
select {
case <-cancel:
// Timed out, cleanup if necessary.
_ = flock.Unlock()
_ = flock.Close()
case result <- err:
}
}()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/onsi/ginkgo/v2 v2.12.0
github.com/onsi/gomega v1.27.10
github.com/pkg/errors v0.9.1
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.26.3
k8s.io/client-go v0.26.1
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/framework/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1 h1:m1LVcHFTcY98hZl0TlE07VPDu/8H1DKyFW8cEVG75+c=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2 h1:XP1qkOi0JZb+itemznercMK+vw5BIuta9lUtmFp8l8U=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
2 changes: 1 addition & 1 deletion test/sample-plugin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/onsi/gomega v1.27.10
github.com/spf13/cobra v1.8.0
github.com/vmware-tanzu/tanzu-cli/test/e2e/framework v1.0.0-dev
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions test/sample-plugin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
github.com/vmware-tanzu/tanzu-cli/test/e2e/framework v1.0.0-dev h1:MoWKHcGmd3G0Lt8sAO+bEI1rh/BIzJcrVv2Tz91koFU=
github.com/vmware-tanzu/tanzu-cli/test/e2e/framework v1.0.0-dev/go.mod h1:zVm0OT9VgEndBzu4YwguM3jDqDOiTDw7TZ8ZgnyAWps=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1 h1:m1LVcHFTcY98hZl0TlE07VPDu/8H1DKyFW8cEVG75+c=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.1/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2 h1:XP1qkOi0JZb+itemznercMK+vw5BIuta9lUtmFp8l8U=
github.com/vmware-tanzu/tanzu-plugin-runtime v1.4.2/go.mod h1:0fTB0rR9BX9kS+xGcwH9O0p97bn8rSdILwWCHgvXzkw=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
Expand Down

0 comments on commit 72f0913

Please sign in to comment.