MCPcopy Create free account
hub / github.com/anchordotdev/cli / checkFile

Method checkFile

truststore/fs.go:136–154  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

134}
135
136func (r *rootFS) checkFile(name string) error {
137 infoFS, err := r.StatFS.Stat(strings.Trim(name, string(os.PathSeparator)))
138 if err != nil {
139 return err
140 }
141
142 infoOS, err := os.Stat(filepath.Join(r.rootPath, name))
143 if err != nil {
144 return err
145 }
146
147 if infoFS.Name() == infoOS.Name() && infoFS.Size() == infoOS.Size() &&
148 infoFS.Mode() == infoOS.Mode() && infoFS.ModTime().Equal(infoOS.ModTime()) &&
149 reflect.DeepEqual(infoFS.Sys(), infoOS.Sys()) {
150 return nil
151 }
152
153 return errors.New("file system setup is misconfigured or corrupt")
154}

Callers 1

ReadFileMethod · 0.95

Calls 8

NameMethod · 0.80
SizeMethod · 0.80
ModeMethod · 0.80
EqualMethod · 0.80
ModTimeMethod · 0.80
SysMethod · 0.80
NewMethod · 0.80
StatMethod · 0.65

Tested by

no test coverage detected