MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Update

Method Update

pkg/devspace/watch/watch.go:103–133  ·  view source on GitHub ↗

Update updates the filemap and returns if there was a change

()

Source from the content-addressed store, hash-verified

101
102// Update updates the filemap and returns if there was a change
103func (w *watcher) Update() ([]string, []string, error) {
104 fileMap := make(map[string]os.FileInfo)
105
106 for _, pattern := range w.Paths {
107 files, err := doublestar.Glob(pattern)
108 if err != nil {
109 return nil, nil, err
110 }
111
112 for _, file := range files {
113 stat, err := os.Stat(file)
114 if err != nil {
115 continue
116 }
117
118 // is excluded?
119 if w.Exclude != nil && w.Exclude.Matches(file, stat.IsDir()) {
120 continue
121 }
122
123 fileMap[file] = stat
124 }
125 }
126
127 changed, deleted := w.gatherChanges(fileMap)
128
129 // Update map
130 w.FileMap = fileMap
131
132 return changed, deleted, nil
133}
134
135func (w *watcher) gatherChanges(newState map[string]os.FileInfo) ([]string, []string) {
136 changed := make([]string, 0, 1)

Callers 2

NewFunction · 0.95
StartMethod · 0.95

Calls 3

gatherChangesMethod · 0.95
MatchesMethod · 0.65
IsDirMethod · 0.45

Tested by

no test coverage detected