mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 16:13:45 +08:00 
			
		
		
		
	vendor: github.com/gofrs/flock v0.7.3
full diff: https://github.com/gofrs/flock/compare/v0.7.0...v0.7.3 v0.7.3 ------------------------- - Fix issues in the license file, update year. v0.7.2 ------------------------- - Ensure we release file handle if we failed to take an exclusive lock v0.7.1 ------------------------- - Fix linting issues and add goreportcard badge Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ require ( | |||||||
| 	github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect | 	github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect | ||||||
| 	github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect | 	github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect | ||||||
| 	github.com/go-sql-driver/mysql v1.4.1 // indirect | 	github.com/go-sql-driver/mysql v1.4.1 // indirect | ||||||
| 	github.com/gofrs/flock v0.7.0 | 	github.com/gofrs/flock v0.7.2 | ||||||
| 	github.com/gofrs/uuid v3.2.0+incompatible // indirect | 	github.com/gofrs/uuid v3.2.0+incompatible // indirect | ||||||
| 	github.com/google/certificate-transparency-go v1.0.21 // indirect | 	github.com/google/certificate-transparency-go v1.0.21 // indirect | ||||||
| 	github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 | 	github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.sum
									
									
									
									
									
								
							| @@ -196,6 +196,8 @@ github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= | |||||||
| github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= | github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= | ||||||
| github.com/gofrs/flock v0.7.0 h1:pGFUjl501gafK9HBt1VGL1KCOd/YhIooID+xgyJCf3g= | github.com/gofrs/flock v0.7.0 h1:pGFUjl501gafK9HBt1VGL1KCOd/YhIooID+xgyJCf3g= | ||||||
| github.com/gofrs/flock v0.7.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= | github.com/gofrs/flock v0.7.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= | ||||||
|  | github.com/gofrs/flock v0.7.2 h1:JkFf/PGP1ZOSzUHY03OQp06aeiIim523smfhMdFvP+o= | ||||||
|  | github.com/gofrs/flock v0.7.2/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= | ||||||
| github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= | github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= | ||||||
| github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= | github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= | ||||||
| github.com/gogo/googleapis v1.3.2 h1:kX1es4djPJrsDhY7aZKJy7aZasdcB5oSOEphMjSB53c= | github.com/gogo/googleapis v1.3.2 h1:kX1es4djPJrsDhY7aZKJy7aZasdcB5oSOEphMjSB53c= | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								vendor/github.com/gofrs/flock/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/gofrs/flock/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,7 +1,8 @@ | |||||||
| # flock | # flock | ||||||
| [](https://travis-ci.org/gofrs/flock) | [](https://travis-ci.org/gofrs/flock) | ||||||
| [](https://godoc.org/github.com/gofrs/flock) | [](https://godoc.org/github.com/gofrs/flock) | ||||||
| [](https://github.com/gofrs/flock/blob/master/LICENSE) | [](https://github.com/gofrs/flock/blob/master/LICENSE) | ||||||
|  | [](https://goreportcard.com/report/github.com/gofrs/flock) | ||||||
|  |  | ||||||
| `flock` implements a thread-safe sync.Locker interface for file locking. It also | `flock` implements a thread-safe sync.Locker interface for file locking. It also | ||||||
| includes a non-blocking TryLock() function to allow locking without blocking execution. | includes a non-blocking TryLock() function to allow locking without blocking execution. | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								vendor/github.com/gofrs/flock/flock.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/github.com/gofrs/flock/flock.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -2,7 +2,7 @@ | |||||||
| // Use of this source code is governed by the BSD 3-Clause | // Use of this source code is governed by the BSD 3-Clause | ||||||
| // license that can be found in the LICENSE file. | // license that can be found in the LICENSE file. | ||||||
|  |  | ||||||
| // Package flock implements a thread-safe sync.Locker interface for file locking. | // Package flock implements a thread-safe interface for file locking. | ||||||
| // It also includes a non-blocking TryLock() function to allow locking | // It also includes a non-blocking TryLock() function to allow locking | ||||||
| // without blocking execution. | // without blocking execution. | ||||||
| // | // | ||||||
| @@ -13,7 +13,7 @@ | |||||||
| // guaranteed to be the same on each platform. For example, some UNIX-like | // guaranteed to be the same on each platform. For example, some UNIX-like | ||||||
| // operating systems will transparently convert a shared lock to an exclusive | // operating systems will transparently convert a shared lock to an exclusive | ||||||
| // lock. If you Unlock() the flock from a location where you believe that you | // lock. If you Unlock() the flock from a location where you believe that you | ||||||
| // have the shared lock, you may accidently drop the exclusive lock. | // have the shared lock, you may accidentally drop the exclusive lock. | ||||||
| package flock | package flock | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| @@ -86,17 +86,17 @@ func (f *Flock) String() string { | |||||||
| // conditions is met: TryLock succeeds, TryLock fails with error, or Context | // conditions is met: TryLock succeeds, TryLock fails with error, or Context | ||||||
| // Done channel is closed. | // Done channel is closed. | ||||||
| func (f *Flock) TryLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) { | func (f *Flock) TryLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) { | ||||||
| 	return tryCtx(f.TryLock, ctx, retryDelay) | 	return tryCtx(ctx, f.TryLock, retryDelay) | ||||||
| } | } | ||||||
|  |  | ||||||
| // TryRLockContext repeatedly tries to take a shared lock until one of the | // TryRLockContext repeatedly tries to take a shared lock until one of the | ||||||
| // conditions is met: TryRLock succeeds, TryRLock fails with error, or Context | // conditions is met: TryRLock succeeds, TryRLock fails with error, or Context | ||||||
| // Done channel is closed. | // Done channel is closed. | ||||||
| func (f *Flock) TryRLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) { | func (f *Flock) TryRLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) { | ||||||
| 	return tryCtx(f.TryRLock, ctx, retryDelay) | 	return tryCtx(ctx, f.TryRLock, retryDelay) | ||||||
| } | } | ||||||
|  |  | ||||||
| func tryCtx(fn func() (bool, error), ctx context.Context, retryDelay time.Duration) (bool, error) { | func tryCtx(ctx context.Context, fn func() (bool, error), retryDelay time.Duration) (bool, error) { | ||||||
| 	if ctx.Err() != nil { | 	if ctx.Err() != nil { | ||||||
| 		return false, ctx.Err() | 		return false, ctx.Err() | ||||||
| 	} | 	} | ||||||
| @@ -125,3 +125,11 @@ func (f *Flock) setFh() error { | |||||||
| 	f.fh = fh | 	f.fh = fh | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ensure the file handle is closed if no lock is held | ||||||
|  | func (f *Flock) ensureFhState() { | ||||||
|  | 	if !f.l && !f.r && f.fh != nil { | ||||||
|  | 		f.fh.Close() | ||||||
|  | 		f.fh = nil | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -51,6 +51,7 @@ func (f *Flock) lock(locked *bool, flag int) error { | |||||||
| 		if err := f.setFh(); err != nil { | 		if err := f.setFh(); err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  | 		defer f.ensureFhState() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil { | 	if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil { | ||||||
| @@ -142,6 +143,7 @@ func (f *Flock) try(locked *bool, flag int) (bool, error) { | |||||||
| 		if err := f.setFh(); err != nil { | 		if err := f.setFh(); err != nil { | ||||||
| 			return false, err | 			return false, err | ||||||
| 		} | 		} | ||||||
|  | 		defer f.ensureFhState() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	var retried bool | 	var retried bool | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -46,6 +46,7 @@ func (f *Flock) lock(locked *bool, flag uint32) error { | |||||||
| 		if err := f.setFh(); err != nil { | 		if err := f.setFh(); err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  | 		defer f.ensureFhState() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 { | 	if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 { | ||||||
| @@ -122,6 +123,7 @@ func (f *Flock) try(locked *bool, flag uint32) (bool, error) { | |||||||
| 		if err := f.setFh(); err != nil { | 		if err := f.setFh(); err != nil { | ||||||
| 			return false, err | 			return false, err | ||||||
| 		} | 		} | ||||||
|  | 		defer f.ensureFhState() | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{}) | 	_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{}) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -164,7 +164,7 @@ github.com/docker/go-units | |||||||
| # github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c | # github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c | ||||||
| github.com/docker/spdystream | github.com/docker/spdystream | ||||||
| github.com/docker/spdystream/spdy | github.com/docker/spdystream/spdy | ||||||
| # github.com/gofrs/flock v0.7.0 | # github.com/gofrs/flock v0.7.2 | ||||||
| github.com/gofrs/flock | github.com/gofrs/flock | ||||||
| # github.com/gogo/googleapis v1.3.2 | # github.com/gogo/googleapis v1.3.2 | ||||||
| github.com/gogo/googleapis/google/rpc | github.com/gogo/googleapis/google/rpc | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn