MCPcopy Create free account
hub / github.com/cli/cli / sourceFilesLaterThan

Function sourceFilesLaterThan

script/build.go:172–211  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

170}
171
172func sourceFilesLaterThan(t time.Time) bool {
173 foundLater := false
174 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
175 if err != nil {
176 // Ignore errors that occur when the project contains a symlink to a filesystem or volume that
177 // Windows doesn't have access to.
178 if path != "." && isAccessDenied(err) {
179 fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
180 return nil
181 }
182 return err
183 }
184 if foundLater {
185 return filepath.SkipDir
186 }
187 if len(path) > 1 && (path[0] == '.' || path[0] == '_') {
188 if info.IsDir() {
189 return filepath.SkipDir
190 } else {
191 return nil
192 }
193 }
194 if info.IsDir() {
195 if name := filepath.Base(path); name == "vendor" || name == "node_modules" {
196 return filepath.SkipDir
197 }
198 return nil
199 }
200 if path == "go.mod" || path == "go.sum" || (strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, "_test.go")) {
201 if info.ModTime().After(t) {
202 foundLater = true
203 }
204 }
205 return nil
206 })
207 if err != nil {
208 panic(err)
209 }
210 return foundLater
211}
212
213func isAccessDenied(err error) bool {
214 var pe *os.PathError

Callers 1

build.goFile · 0.85

Calls 4

isAccessDeniedFunction · 0.85
IsDirMethod · 0.80
BaseMethod · 0.80
ModTimeMethod · 0.80

Tested by

no test coverage detected