@@ -24,6 +24,7 @@ import (
2424 "fmt"
2525 "hash"
2626 "io"
27+ "io/fs"
2728 "net/url"
2829 "os"
2930 "path/filepath"
@@ -32,16 +33,12 @@ import (
3233 "time"
3334
3435 securejoin "github.com/cyphar/filepath-securejoin"
36+ "github.com/fluxcd/pkg/lockedfile"
37+ "github.com/fluxcd/pkg/untar"
3538 "github.com/go-git/go-git/v5/plumbing/format/gitignore"
36- kerrors "k8s.io/apimachinery/pkg/util/errors"
37-
3839 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
40+ kerrors "k8s.io/apimachinery/pkg/util/errors"
3941
40- "github.com/fluxcd/pkg/lockedfile"
41-
42- "io/fs"
43-
44- "github.com/fluxcd/pkg/untar"
4542 sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
4643 sourcefs "github.com/fluxcd/source-controller/internal/fs"
4744 "github.com/fluxcd/source-controller/pkg/sourceignore"
@@ -181,7 +178,7 @@ func (s *Storage) getGarbageFiles(artifact sourcev1.Artifact, totalCountLimit, m
181178 return nil
182179 }
183180 if totalFiles >= totalCountLimit {
184- return fmt .Errorf ("Reached file walking limit, already walked over: %d" , totalFiles )
181+ return fmt .Errorf ("reached file walking limit, already walked over: %d" , totalFiles )
185182 }
186183 info , err := d .Info ()
187184 if err != nil {
@@ -190,8 +187,8 @@ func (s *Storage) getGarbageFiles(artifact sourcev1.Artifact, totalCountLimit, m
190187 }
191188 createdAt := info .ModTime ().UTC ()
192189 diff := now .Sub (createdAt )
193- // compare the time difference between now and the time at which the file was created
194- // with the provided ttl. delete if difference is greater than the ttl .
190+ // Compare the time difference between now and the time at which the file was created
191+ // with the provided TTL. Delete if the difference is greater than the TTL .
195192 expired := diff > ttl
196193 if ! info .IsDir () && info .Mode ()& os .ModeSymlink != os .ModeSymlink {
197194 if path != localPath && expired {
0 commit comments