storage/filesystem/module.go
raw| 1 | package filesystem |
| 2 | |
| 3 | import ( |
| 4 | "github.com/go-git/go-git/v5/plumbing/cache" |
| 5 | "github.com/go-git/go-git/v5/storage" |
| 6 | "github.com/go-git/go-git/v5/storage/filesystem/dotgit" |
| 7 | ) |
| 8 | |
| 9 | type ModuleStorage struct { |
| 10 | dir *dotgit.DotGit |
| 11 | } |
| 12 | |
| 13 | func (s *ModuleStorage) Module(name string) (storage.Storer, error) { |
| 14 | fs, err := s.dir.Module(name) |
| 15 | if err != nil { |
| 16 | return nil, err |
| 17 | } |
| 18 | |
| 19 | return NewStorage(fs, cache.NewObjectLRUDefault()), nil |
| 20 | } |