mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-21 16:05:40 +00:00
*.go: goimports -w .
`
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
732bc463ba
commit
4ab44bff01
4 changed files with 12 additions and 5 deletions
|
@ -459,6 +459,7 @@ func compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword, same bool) ([]Ino
|
||||||
// InodeDeltas.
|
// InodeDeltas.
|
||||||
//
|
//
|
||||||
// NB: The order of the parameters matters (old, new) because Extra and
|
// NB: The order of the parameters matters (old, new) because Extra and
|
||||||
|
//
|
||||||
// Missing are considered as different discrepancy types.
|
// Missing are considered as different discrepancy types.
|
||||||
func Compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword) ([]InodeDelta, error) {
|
func Compare(oldDh, newDh *DirectoryHierarchy, keys []Keyword) ([]InodeDelta, error) {
|
||||||
return compare(oldDh, newDh, keys, false)
|
return compare(oldDh, newDh, keys, false)
|
||||||
|
|
3
tar.go
3
tar.go
|
@ -229,6 +229,7 @@ hdrloop:
|
||||||
// appropriate position in the tree. If not, create a path up until the Entry's
|
// appropriate position in the tree. If not, create a path up until the Entry's
|
||||||
// directory that it is contained in. Then, insert the Entry.
|
// directory that it is contained in. Then, insert the Entry.
|
||||||
// root: the "." Entry
|
// root: the "." Entry
|
||||||
|
//
|
||||||
// e: the Entry we are looking to insert
|
// e: the Entry we are looking to insert
|
||||||
// hdr: the tar header struct associated with e
|
// hdr: the tar header struct associated with e
|
||||||
func populateTree(root, e *Entry, hdr *tar.Header) error {
|
func populateTree(root, e *Entry, hdr *tar.Header) error {
|
||||||
|
@ -295,8 +296,10 @@ func populateTree(root, e *Entry, hdr *tar.Header) error {
|
||||||
|
|
||||||
// After constructing a pseudo file hierarchy tree, we want to "flatten" this
|
// After constructing a pseudo file hierarchy tree, we want to "flatten" this
|
||||||
// tree by putting the Entries into a slice with appropriate positioning.
|
// tree by putting the Entries into a slice with appropriate positioning.
|
||||||
|
//
|
||||||
// root: the "head" of the sub-tree to flatten
|
// root: the "head" of the sub-tree to flatten
|
||||||
// creator: a dhCreator that helps with the '/set' keyword
|
// creator: a dhCreator that helps with the '/set' keyword
|
||||||
|
//
|
||||||
// keywords: keywords specified by the user that should be evaluated
|
// keywords: keywords specified by the user that should be evaluated
|
||||||
func flatten(root *Entry, creator *dhCreator, keywords []Keyword) {
|
func flatten(root *Entry, creator *dhCreator, keywords []Keyword) {
|
||||||
if root == nil || creator == nil {
|
if root == nil || creator == nil {
|
||||||
|
|
|
@ -128,6 +128,7 @@ func TestTar(t *testing.T) {
|
||||||
// `tar -cvf some.tar dir1 dir2 dir3 dir4/dir5 dir6` ... etc.
|
// `tar -cvf some.tar dir1 dir2 dir3 dir4/dir5 dir6` ... etc.
|
||||||
// The testdata of collection.tar resemble such an archive. the `collection` folder
|
// The testdata of collection.tar resemble such an archive. the `collection` folder
|
||||||
// is the contents of `collection.tar` extracted
|
// is the contents of `collection.tar` extracted
|
||||||
|
//
|
||||||
//gocyclo:ignore
|
//gocyclo:ignore
|
||||||
func TestArchiveCreation(t *testing.T) {
|
func TestArchiveCreation(t *testing.T) {
|
||||||
fh, err := os.Open("./testdata/collection.tar")
|
fh, err := os.Open("./testdata/collection.tar")
|
||||||
|
@ -197,6 +198,7 @@ func TestArchiveCreation(t *testing.T) {
|
||||||
// evaluated. Also, The fact that this archive contains a single entry, yet the
|
// evaluated. Also, The fact that this archive contains a single entry, yet the
|
||||||
// entry is associated with a file that has parent directories, means that the
|
// entry is associated with a file that has parent directories, means that the
|
||||||
// "." directory should be the lowest sub-directory under which `file` is contained.
|
// "." directory should be the lowest sub-directory under which `file` is contained.
|
||||||
|
//
|
||||||
//gocyclo:ignore
|
//gocyclo:ignore
|
||||||
func TestTreeTraversal(t *testing.T) {
|
func TestTreeTraversal(t *testing.T) {
|
||||||
fh, err := os.Open("./testdata/traversal.tar")
|
fh, err := os.Open("./testdata/traversal.tar")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package xattr
|
package xattr
|
||||||
|
|
Loading…
Reference in a new issue