|
|
@ -40,7 +40,7 @@ func getGoogleDoc(client *http.Client, match map[string]string, installRepoPath |
|
|
|
setupGoogleMatch(match) |
|
|
|
setupGoogleMatch(match) |
|
|
|
// Check version control.
|
|
|
|
// Check version control.
|
|
|
|
if err := getGoogleVCS(client, match); err != nil { |
|
|
|
if err := getGoogleVCS(client, match); err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, errors.New("fail to get vcs " + nod.ImportPath + " : " + err.Error()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch nod.Type { |
|
|
|
switch nod.Type { |
|
|
@ -112,33 +112,37 @@ func getGoogleDoc(client *http.Client, match map[string]string, installRepoPath |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get file from archive.
|
|
|
|
// Get file from archive.
|
|
|
|
rc, err := f.Open() |
|
|
|
r, err := f.Open() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Write data to file
|
|
|
|
fbytes := make([]byte, f.FileInfo().Size()) |
|
|
|
fw, _ := os.Create(absPath) |
|
|
|
_, err = io.ReadFull(r, fbytes) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_, err = io.Copy(fw, rc) |
|
|
|
_, err = com.SaveFile(absPath, fbytes) |
|
|
|
// Close files.
|
|
|
|
|
|
|
|
rc.Close() |
|
|
|
|
|
|
|
fw.Close() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var imports []string |
|
|
|
|
|
|
|
|
|
|
|
// Check if need to check imports.
|
|
|
|
// Check if need to check imports.
|
|
|
|
if nod.IsGetDeps { |
|
|
|
if nod.IsGetDeps { |
|
|
|
imports := getImports(installPath+"/", match, cmdFlags, nod) |
|
|
|
for _, d := range dirs { |
|
|
|
return imports, err |
|
|
|
importPkgs, err := CheckImports(d, match["importPath"], nod) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imports = append(imports, importPkgs...) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return nil, err |
|
|
|
return imports, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type rawFile struct { |
|
|
|
type rawFile struct { |
|
|
|