fix not cross-os file lock (#818)

This commit is contained in:
Isaev Denis 2019-10-14 19:46:59 +03:00 committed by GitHub
parent 48599c64ba
commit fa69ddfc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"path/filepath"
"time" "time"
"github.com/golangci/golangci-lint/internal/cache" "github.com/golangci/golangci-lint/internal/cache"
@ -205,7 +206,7 @@ func computeConfigSalt(cfg *config.Config) ([]byte, error) {
} }
func (e *Executor) acquireFileLock() bool { func (e *Executor) acquireFileLock() bool {
lockFile := os.TempDir() + "/golangci-lint.lock" lockFile := filepath.Join(os.TempDir(), "golangci-lint.lock")
e.debugf("Locking on file %s...", lockFile) e.debugf("Locking on file %s...", lockFile)
f := flock.New(lockFile) f := flock.New(lockFile)
ctx, finish := context.WithTimeout(context.Background(), time.Minute) ctx, finish := context.WithTimeout(context.Background(), time.Minute)