From f79c75ab10eca594cf80b1b0b8c69753b1a37a57 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Thu, 25 Feb 2021 11:26:46 -0500 Subject: [PATCH] test: fix lint errors on Darwin (macOS) (#4247) Unused code linter isn't particularly smart about platform build tags, so since this func is only used by the "naive" (non-macOS) file watcher, it needs to live with that or it gets flagged as dead code when linting on macOS. --- pkg/watch/paths.go | 11 ----------- pkg/watch/watcher_naive.go | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pkg/watch/paths.go b/pkg/watch/paths.go index d0651d848..b2817cdc1 100644 --- a/pkg/watch/paths.go +++ b/pkg/watch/paths.go @@ -10,17 +10,6 @@ import ( "github.com/tilt-dev/tilt/internal/ospath" ) -func greatestExistingAncestors(paths []string) ([]string, error) { - result := []string{} - for _, p := range paths { - newP, err := greatestExistingAncestor(p) - if err != nil { - return nil, fmt.Errorf("Finding ancestor of %s: %v", p, err) - } - result = append(result, newP) - } - return result, nil -} func greatestExistingAncestor(path string) (string, error) { if path == string(filepath.Separator) || path == fmt.Sprintf("%s%s", filepath.VolumeName(path), string(filepath.Separator)) { diff --git a/pkg/watch/watcher_naive.go b/pkg/watch/watcher_naive.go index d42d3a609..f66d5ad52 100644 --- a/pkg/watch/watcher_naive.go +++ b/pkg/watch/watcher_naive.go @@ -303,3 +303,15 @@ func newWatcher(paths []string, ignore PathMatcher, l logger.Logger) (*naiveNoti } var _ Notify = &naiveNotify{} + +func greatestExistingAncestors(paths []string) ([]string, error) { + result := []string{} + for _, p := range paths { + newP, err := greatestExistingAncestor(p) + if err != nil { + return nil, fmt.Errorf("Finding ancestor of %s: %v", p, err) + } + result = append(result, newP) + } + return result, nil +}