@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"log"
"path"
"path/filepath"
"strings"
"sync"
@ -207,12 +208,16 @@ func (t *Tree) getChildren(s *Storage) (map[string]*Tree, error) {
}
// Determine the path to this child
p ath := make ( [ ] string , len ( t . path ) , len ( t . path ) + 1 )
copy ( p ath, t . path )
path = append ( p ath, m . Name )
modP ath := make ( [ ] string , len ( t . path ) , len ( t . path ) + 1 )
copy ( modP ath, t . path )
modPath = append ( modP ath, m . Name )
log . Printf ( "[TRACE] module source: %q" , m . Source )
// add the module path to help indicate where modules with relative
// paths are being loaded from
s . output ( fmt . Sprintf ( "- Module %q" , path . Join ( modPath ... ) ) )
// Lookup the local location of the module.
// dir is the local directory where the module is stored
mod , err := s . findRegistryModule ( m . Source , m . Version )
@ -236,7 +241,7 @@ func (t *Tree) getChildren(s *Storage) (map[string]*Tree, error) {
}
}
if mod . Dir != "" {
if mod . Dir != "" && s . Mode != GetModeUpdate {
// We found it locally, but in order to load the Tree we need to
// find out if there was another subDir stored from detection.
subDir , err := s . getModuleRoot ( mod . Dir )
@ -245,20 +250,20 @@ func (t *Tree) getChildren(s *Storage) (map[string]*Tree, error) {
// recordSubdir method fix it up. Any other filesystem errors
// will turn up again below.
log . Println ( "[WARN] error reading subdir record:" , err )
} else {
fullDir := filepath . Join ( mod . Dir , subDir )
}
child , err := NewTreeModule ( m . Name , fullDir )
if err != nil {
return nil , fmt . Errorf ( "module %s: %s" , m . Name , err )
}
child . path = path
child . parent = t
child . version = mod . Version
child . source = m . Source
children [ m . Name ] = child
continue
fullDir := filepath . Join ( mod . Dir , subDir )
child , err := NewTreeModule ( m . Name , fullDir )
if err != nil {
return nil , fmt . Errorf ( "module %s: %s" , m . Name , err )
}
child . path = modPath
child . parent = t
child . version = mod . Version
child . source = m . Source
children [ m . Name ] = child
continue
}
// Split out the subdir if we have one.
@ -286,6 +291,9 @@ func (t *Tree) getChildren(s *Storage) (map[string]*Tree, error) {
subDir = filepath . Join ( detectedSubDir , subDir )
}
output := fmt . Sprintf ( " Getting source %q" , m . Source )
s . output ( output )
dir , ok , err := s . getStorage ( key , source )
if err != nil {
return nil , err
@ -325,7 +333,7 @@ func (t *Tree) getChildren(s *Storage) (map[string]*Tree, error) {
if err != nil {
return nil , fmt . Errorf ( "module %s: %s" , m . Name , err )
}
child . path = p ath
child . path = modP ath
child . parent = t
child . version = mod . Version
child . source = m . Source