Skip to content

Commit 392e7fa

Browse files
committed
Merge pull request #35 from tariq1890/fix_lint
Fix linting issues and add goreportcard badge Signed-off-by: Tim Heckman <[email protected]>
2 parents 971941c + 5acf602 commit 392e7fa

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![TravisCI Build Status](https://img.shields.io/travis/gofrs/flock/master.svg?style=flat)](https://travis-ci.org/gofrs/flock)
33
[![GoDoc](https://img.shields.io/badge/godoc-go--flock-blue.svg?style=flat)](https://godoc.org/github.com/gofrs/flock)
44
[![License](https://img.shields.io/badge/license-BSD_3--Clause-brightgreen.svg?style=flat)](https://github.com/gofrs/flock/blob/master/LICENSE)
5+
[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/flock)](https://goreportcard.com/report/github.com/gofrs/flock)
56

67
`flock` implements a thread-safe sync.Locker interface for file locking. It also
78
includes a non-blocking TryLock() function to allow locking without blocking execution.

flock.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// guaranteed to be the same on each platform. For example, some UNIX-like
1414
// operating systems will transparently convert a shared lock to an exclusive
1515
// lock. If you Unlock() the flock from a location where you believe that you
16-
// have the shared lock, you may accidently drop the exclusive lock.
16+
// have the shared lock, you may accidentally drop the exclusive lock.
1717
package flock
1818

1919
import (
@@ -86,17 +86,17 @@ func (f *Flock) String() string {
8686
// conditions is met: TryLock succeeds, TryLock fails with error, or Context
8787
// Done channel is closed.
8888
func (f *Flock) TryLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
89-
return tryCtx(f.TryLock, ctx, retryDelay)
89+
return tryCtx(ctx, f.TryLock, retryDelay)
9090
}
9191

9292
// TryRLockContext repeatedly tries to take a shared lock until one of the
9393
// conditions is met: TryRLock succeeds, TryRLock fails with error, or Context
9494
// Done channel is closed.
9595
func (f *Flock) TryRLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
96-
return tryCtx(f.TryRLock, ctx, retryDelay)
96+
return tryCtx(ctx, f.TryRLock, retryDelay)
9797
}
9898

99-
func tryCtx(fn func() (bool, error), ctx context.Context, retryDelay time.Duration) (bool, error) {
99+
func tryCtx(ctx context.Context, fn func() (bool, error), retryDelay time.Duration) (bool, error) {
100100
if ctx.Err() != nil {
101101
return false, ctx.Err()
102102
}

0 commit comments

Comments
 (0)