MCPcopy Create free account
hub / github.com/diskfs/go-diskfs / ExampleOpenBackend_open

Function ExampleOpenBackend_open

example_test.go:164–173  ·  view source on GitHub ↗

Open existing image using backend abstraction This is a proposed way of usage after factoring out underlying file operations to the backend. diskfs.Open() is slowly deprecating now.

()

Source from the content-addressed store, hash-verified

162// This is a proposed way of usage after factoring out underlying file operations to the backend.
163// diskfs.Open() is slowly deprecating now.
164func ExampleOpenBackend_open() {
165 readOnly := true
166 theBackend, err := file.OpenFromPath("/tmp/my.img", readOnly)
167 check(err)
168 defer os.Remove("/tmp/my.img")
169
170 theDisk, err := diskfs.OpenBackend(theBackend)
171 check(err)
172 unused(theDisk)
173}
174
175// Instantiate the backend manually for later use in diskfs.OpenBackend
176func ExampleOpenBackend_backend() {

Callers

nothing calls this directly

Calls 4

OpenFromPathFunction · 0.92
checkFunction · 0.70
unusedFunction · 0.70
RemoveMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…