NewItem creates an item from a string content
(Path, Content string, modTime time.Time)
| 95 | |
| 96 | // NewItem creates an item from a string content |
| 97 | func NewItem(Path, Content string, modTime time.Time) Item { |
| 98 | i := Item{ |
| 99 | Path: Path, |
| 100 | ModTime: modTime, |
| 101 | Size: int64(len(Content)), |
| 102 | } |
| 103 | hash := hash.NewMultiHasher() |
| 104 | buf := bytes.NewBufferString(Content) |
| 105 | _, err := io.Copy(hash, buf) |
| 106 | if err != nil { |
| 107 | fs.Fatalf(nil, "Failed to create item: %v", err) |
| 108 | } |
| 109 | i.Hashes = hash.Sums() |
| 110 | return i |
| 111 | } |
| 112 | |
| 113 | // CheckTimeEqualWithPrecision checks the times are equal within the |
| 114 | // precision, returns the delta and a flag |
searching dependent graphs…