MCPcopy
hub / github.com/hashicorp/go-getter / Get

Method Get

folder_storage.go:43–60  ·  view source on GitHub ↗

Get implements Storage.Get

(ctx context.Context, key string, source string, update bool)

Source from the content-addressed store, hash-verified

41
42// Get implements Storage.Get
43func (s *FolderStorage) Get(ctx context.Context, key string, source string, update bool) error {
44 dir := s.dir(key)
45 if !update {
46 if _, err := os.Stat(dir); err == nil {
47 // If the directory already exists, then we're done since
48 // we're not updating.
49 return nil
50 } else if !os.IsNotExist(err) {
51 // If the error we got wasn't a file-not-exist error, then
52 // something went wrong and we should report it.
53 return fmt.Errorf("Error reading module directory: %s", err)
54 }
55 }
56
57 // Get the source. This always forces an update.
58 _, err := Get(ctx, dir, source)
59 return err
60}
61
62// dir returns the directory name internally that we'll use to map to
63// internally.

Callers 1

TestFolderStorageFunction · 0.95

Calls 2

dirMethod · 0.95
GetFunction · 0.85

Tested by 1

TestFolderStorageFunction · 0.76