From 5f78ea4aee9631e08a12492be91a9fd4ef8b384e Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Mon, 22 Jul 2024 13:57:28 +0700 Subject: [PATCH] refactor(fs): remove unused field for CompositeFS (#7195) Signed-off-by: nikpivkin --- pkg/fanal/analyzer/analyzer.go | 2 +- pkg/fanal/analyzer/analyzer_test.go | 2 +- pkg/fanal/analyzer/fs.go | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/fanal/analyzer/analyzer.go b/pkg/fanal/analyzer/analyzer.go index 119a589190a2..d2d07ffcc733 100644 --- a/pkg/fanal/analyzer/analyzer.go +++ b/pkg/fanal/analyzer/analyzer.go @@ -504,7 +504,7 @@ func (ag AnalyzerGroup) PostAnalyze(ctx context.Context, compositeFS *CompositeF // PostAnalyzerFS returns a composite filesystem that contains multiple filesystems for each post-analyzer func (ag AnalyzerGroup) PostAnalyzerFS() (*CompositeFS, error) { - return NewCompositeFS(ag) + return NewCompositeFS() } func (ag AnalyzerGroup) filePatternMatch(analyzerType Type, filePath string) bool { diff --git a/pkg/fanal/analyzer/analyzer_test.go b/pkg/fanal/analyzer/analyzer_test.go index 671c1050837f..313fccda7e94 100644 --- a/pkg/fanal/analyzer/analyzer_test.go +++ b/pkg/fanal/analyzer/analyzer_test.go @@ -614,7 +614,7 @@ func TestAnalyzerGroup_PostAnalyze(t *testing.T) { require.NoError(t, err) // Create a virtual filesystem - composite, err := analyzer.NewCompositeFS(analyzer.AnalyzerGroup{}) + composite, err := analyzer.NewCompositeFS() require.NoError(t, err) mfs := mapfs.New() diff --git a/pkg/fanal/analyzer/fs.go b/pkg/fanal/analyzer/fs.go index 28880b6b0339..4fec721e3cf6 100644 --- a/pkg/fanal/analyzer/fs.go +++ b/pkg/fanal/analyzer/fs.go @@ -15,19 +15,17 @@ import ( // CompositeFS contains multiple filesystems for post-analyzers type CompositeFS struct { - group AnalyzerGroup dir string files *sync.Map[Type, *mapfs.FS] } -func NewCompositeFS(group AnalyzerGroup) (*CompositeFS, error) { +func NewCompositeFS() (*CompositeFS, error) { tmpDir, err := os.MkdirTemp("", "analyzer-fs-*") if err != nil { return nil, xerrors.Errorf("unable to create temporary directory: %w", err) } return &CompositeFS{ - group: group, dir: tmpDir, files: new(sync.Map[Type, *mapfs.FS]), }, nil