Write a lock for now.
()
| 50 | |
| 51 | // Write a lock for now. |
| 52 | func writeLock() error { |
| 53 | |
| 54 | // If the lock should not be written exit immediately. This happens in cases |
| 55 | // where shutdown/clean is happening. |
| 56 | if !shouldWriteLock { |
| 57 | return nil |
| 58 | } |
| 59 | |
| 60 | ld := &lockdata{ |
| 61 | Comment: "File managed by Glide (https://glide.sh)", |
| 62 | Pid: os.Getpid(), |
| 63 | Time: time.Now().Format(time.RFC3339Nano), |
| 64 | } |
| 65 | |
| 66 | out, err := json.Marshal(ld) |
| 67 | if err != nil { |
| 68 | return err |
| 69 | } |
| 70 | err = ioutil.WriteFile(lockFileName, out, 0755) |
| 71 | return err |
| 72 | } |
| 73 | |
| 74 | func startLock() error { |
| 75 | err := writeLock() |