Skip to content

Commit

Permalink
🐛 Fixed warning created by go:embed files.
Browse files Browse the repository at this point in the history
  • Loading branch information
noyshabtay committed Nov 30, 2023
1 parent 477045b commit 7f4d92f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/com/jfrog/ide/common/go/GoScanWorkspaceCreator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jfrog.ide.common.go;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.jfrog.build.api.util.Log;
import org.jfrog.build.extractor.go.GoDriver;
Expand Down Expand Up @@ -68,8 +69,17 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
Path targetGoMod = targetDir.resolve(sourceDir.relativize(file));
Files.copy(file, targetGoMod);
goDriver.runCmd("run . -goModPath=" + targetGoMod.toAbsolutePath() + " -wd=" + sourceDir.toAbsolutePath(), true);
return FileVisitResult.CONTINUE;
}
// Skip .git, .idea and .vscode (deny list) directories.
if (StringUtils.containsAny(fileName, ".git", ".idea", ".vscode")) {
return FileVisitResult.SKIP_SUBTREE;
}
// Files other than go.mod and *.go files are not necessary to build the dependency tree of used Go packages.
// Therefore, we just create an empty file with the same name so go:embed files won't cause a missing file error.
if (!fileName.equals("go.sum")) {
Files.createFile(targetDir.resolve(sourceDir.relativize(file)));
}
return FileVisitResult.CONTINUE;
}

Expand Down

0 comments on commit 7f4d92f

Please sign in to comment.