MCPcopy
hub / github.com/cli/cli / sourceFilesLaterThan

Function sourceFilesLaterThan

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

Source from the content-addressed store, hash-verified

144}
145
146func sourceFilesLaterThan(t time.Time) bool {
147 foundLater := false
148 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
149 if err != nil {
150 // Ignore errors that occur when the project contains a symlink to a filesystem or volume that
151 // Windows doesn't have access to.
152 if path != "." && isAccessDenied(err) {
153 fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
154 return nil
155 }
156 return err
157 }
158 if foundLater {
159 return filepath.SkipDir
160 }
161 if len(path) > 1 && (path[0] == '.' || path[0] == '_') {
162 if info.IsDir() {
163 return filepath.SkipDir
164 } else {
165 return nil
166 }
167 }
168 if info.IsDir() {
169 if name := filepath.Base(path); name == "vendor" || name == "node_modules" {
170 return filepath.SkipDir
171 }
172 return nil
173 }
174 if path == "go.mod" || path == "go.sum" || (strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, "_test.go")) {
175 if info.ModTime().After(t) {
176 foundLater = true
177 }
178 }
179 return nil
180 })
181 if err != nil {
182 panic(err)
183 }
184 return foundLater
185}
186
187func isAccessDenied(err error) bool {
188 var pe *os.PathError

Callers 1

build.goFile · 0.85

Calls 2

isAccessDeniedFunction · 0.85
BaseMethod · 0.80

Tested by

no test coverage detected