use of com.synopsys.integration.detectable.detectables.go.godep.model.Project in project synopsys-detect by blackducksoftware.
the class GoLockParser method parseDepLock.
public DependencyGraph parseDepLock(InputStream depLockInputStream) {
DependencyGraph graph = new BasicDependencyGraph();
GoLock goLock = new Toml().read(depLockInputStream).to(GoLock.class);
if (goLock.projects != null) {
for (Project project : goLock.projects) {
if (project != null) {
String projectName = project.getName();
String projectVersion = Optional.ofNullable(StringUtils.stripToNull(project.getVersion())).orElse(project.getRevision());
project.getPackages().stream().map(packageName -> createDependencyName(projectName, packageName)).map(dependencyName -> createGoDependency(dependencyName, projectVersion)).forEach(graph::addChildToRoot);
}
}
}
return graph;
}
Aggregations