forked from freddierice/go-losetup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
467ac40
commit fc9adea
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
# go-losetup | ||
A losetup implementation for go-lang | ||
|
||
## how to get it | ||
``` | ||
go get gopkg.in/freddierice/go-losetup.v1 | ||
``` | ||
|
||
## example usage | ||
```go | ||
// attach a raw file to a loop device | ||
dev, err := losetup.Attach("rawfile.img", 0, false) | ||
if err != nil { | ||
// error checking | ||
} | ||
|
||
fmt.Printf("attached rawfile.img to %v\n", dev.Path()) | ||
|
||
err := dev.Detach() | ||
if err != nil { | ||
// error checking | ||
} | ||
``` | ||
|