Skip to content

Commit

Permalink
Fix CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva committed Nov 7, 2023
1 parent 378affc commit 41b8e4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class GoTreeNode extends RootNode {
directDependenciesGeneralInfos.push(new GeneralInfo(nameVersionTuple[0], nameVersionTuple[1], ['None'], '', PackageType.Go));
}

//Filter out go min version that is written in go mod e.g. go@v1.19
// Filter out go min version that is written in go mod e.g. go@v1.19
directDependenciesGeneralInfos = directDependenciesGeneralInfos.filter(generalInfo => !generalInfo.artifactId.startsWith('go@'));

// Create a set of packages that are actually in use in the project
Expand Down
10 changes: 3 additions & 7 deletions src/main/utils/goUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class GoUtils {
logManager: LogManager,
executeCmdFunction: (goModPath: string, sourceDir: string, goModAbsDir: string) => void
) {
logManager.logMessage('copy go workspace from' + sourceDir + ', to' + targetDir, 'DEBUG');
logManager.logMessage('Copy go workspace from' + sourceDir + ', to' + targetDir, 'DEBUG');
walkdir.find(sourceDir, { follow_symlinks: false, sync: true }, function(curPath: string, stat: fs.Stats) {
let destPath: string = path.resolve(targetDir, path.relative(sourceDir, curPath));

Expand All @@ -220,7 +220,7 @@ export class GoUtils {
this.ignore(curPath);
return;
}
if (!(curPath === sourceDir)) {
if (curPath !== sourceDir) {
// Skip subdirectories with go.mod files.
// These directories are different Go projects and their go files should not be in the root project.
let files: string[] = fs.readdirSync(curPath).filter(fn => fn === 'go.mod');
Expand All @@ -236,11 +236,7 @@ export class GoUtils {
return;
}

if (curPath.endsWith('_test.go')) {
return;
}

logManager.logMessage('copying ' + curPath + ' to ' + destPath, 'DEBUG');
logManager.logMessage('Copying ' + curPath + ' to ' + destPath, 'DEBUG');
fs.copySync(curPath, destPath);

// The root go.mod file is copied and relative path in "replace" are resolved to absolute paths.
Expand Down
2 changes: 0 additions & 2 deletions src/test/tests/goUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ describe('Go Utils Tests', async () => {
const sourceDir: string = path.join(tmpDir, 'prepareProjectWorkspace');
const targetDir: string = path.join(tmpDir, 'tmpDir');


GoUtils.prepareProjectWorkspace(sourceDir, targetDir, '', logManager, () => {
return;
});


assert.isFalse(fs.existsSync(targetDir), 'The target directory should not exist since all files should be excluded');
});
});
Expand Down

0 comments on commit 41b8e4c

Please sign in to comment.