Simplify
This commit is contained in:
parent
1b44c1e1a6
commit
ab1aecd3c5
10
version.go
10
version.go
@ -63,12 +63,12 @@ func newVersion(base string, timestamp time.Time, parent *version) (*version, er
|
|||||||
return ver, nil
|
return ver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *version) scanNode(node *versionedNode) (versionedNodeMap, error) {
|
func (this *version) scanDir(path string) (versionedNodeMap, error) {
|
||||||
var baseNodes versionedNodeMap
|
var baseNodes versionedNodeMap
|
||||||
if this.parent != nil {
|
if this.parent != nil {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
baseNodes, err = this.parent.scanNode(node)
|
baseNodes, err = this.parent.scanDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func (this *version) scanNode(node *versionedNode) (versionedNodeMap, error) {
|
|||||||
|
|
||||||
ownNodes := make(versionedNodeMap)
|
ownNodes := make(versionedNodeMap)
|
||||||
{
|
{
|
||||||
infos, err := ioutil.ReadDir(this.rebasePath(node.path))
|
infos, err := ioutil.ReadDir(this.rebasePath(path))
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -86,7 +86,7 @@ func (this *version) scanNode(node *versionedNode) (versionedNodeMap, error) {
|
|||||||
|
|
||||||
for _, info := range infos {
|
for _, info := range infos {
|
||||||
childName := info.Name()
|
childName := info.Name()
|
||||||
childPath := filepath.Join(node.path, childName)
|
childPath := filepath.Join(path, childName)
|
||||||
ownNodes[childName] = newVersionedNodeStat(childPath, this, nil, info)
|
ownNodes[childName] = newVersionedNodeStat(childPath, this, nil, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ func (this *version) scanNode(node *versionedNode) (versionedNodeMap, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *version) buildVerDir(dir *versionedDir) error {
|
func (this *version) buildVerDir(dir *versionedDir) error {
|
||||||
nodes, err := this.scanNode(dir.node)
|
nodes, err := this.scanDir(dir.node.path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user