From f1bdb65777e2c817dac9705cae7b2486c5dbb28b Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Tue, 25 Feb 2020 09:46:01 +0900 Subject: [PATCH] fix: delete/destroy ordering within directory (#1119) Fixes #979 --- pkg/app/app.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/app/app.go b/pkg/app/app.go index b42a7b1b..15a7efdf 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -649,9 +649,15 @@ func (a *App) findDesiredStateFiles(specifiedPath string) ([]string, error) { if err != nil { return []string{}, err } - sort.Slice(files, func(i, j int) bool { - return files[i] < files[j] - }) + if a.Reverse { + sort.Slice(files, func(i, j int) bool { + return files[j] < files[i] + }) + } else { + sort.Slice(files, func(i, j int) bool { + return files[i] < files[j] + }) + } return files, nil }