MCPcopy Create free account
hub / github.com/Masterminds/glide / writeLock

Function writeLock

cache/global_lock.go:52–72  ·  view source on GitHub ↗

Write a lock for now.

()

Source from the content-addressed store, hash-verified

50
51// Write a lock for now.
52func 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
74func startLock() error {
75 err := writeLock()

Callers 1

startLockFunction · 0.70

Calls 2

MarshalMethod · 0.45
WriteFileMethod · 0.45

Tested by

no test coverage detected