Skip to content

Commit

Permalink
refactor(fs): remove unused field for CompositeFS (#7195)
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin authored Jul 22, 2024
1 parent 5bc662b commit 5f78ea4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/fanal/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions pkg/fanal/analyzer/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f78ea4

Please sign in to comment.