Source:
protected GoExecutor patchExecutor(@NotNull GoExecutor executor) throws ExecutionException { executor.withParameters("test", "-v"); executor.withParameterString(myConfiguration.getGoToolParams()); switch (myConfiguration.getKind()) { case DIRECTORY: String relativePath = FileUtil.getRelativePath(myConfiguration.getWorkingDirectory(), myConfiguration.getDirectoryPath(), File.separatorChar); if (relativePath == "." && myCoverageFilePath != null) { executor.withParameters("."); } else if (relativePath != null) { executor.withParameters("./" + relativePath + "/..."); } else { executor.withParameters("./..."); executor.withWorkDirectory(myConfiguration.getDirectoryPath()); } addFilterParameter(executor, myConfiguration.getPattern()); break; case PACKAGE: executor.withParameters(myConfiguration.getPackage()); addFilterParameter(executor, myConfiguration.getPattern()); break; case FILE: String filePath = myConfiguration.getFilePath(); VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); if (virtualFile == null) { throw new ExecutionException("Test file doesn't exist"); } PsiFile file = PsiManager.getInstance(myConfiguration.getProject()).findFile(virtualFile); if (file == null || !GoTestFinder.isTestFile(file)) { throw new ExecutionException("File '" + filePath + "' is not test file"); } String importPath = ((GoFile)file).getImportPath(); if (StringUtil.isEmpty(importPath)) { throw new ExecutionException("Cannot find import path for " + filePath); } executor.withParameters(importPath); addFilterParameter(executor, buildFilePattern((GoFile)file)); break; } if (myCoverageFilePath != null) { executor.withParameters("-coverprofile=" + myCoverageFilePath, "-covermode=atomic"); } return executor; }

Target:
protected GoExecutor patchExecutor(@NotNull GoExecutor executor) throws ExecutionException { executor.withParameters("test", "-v"); executor.withParameterString(myConfiguration.getGoToolParams()); switch (myConfiguration.getKind()) { case DIRECTORY: String relativePath = FileUtil.getRelativePath(myConfiguration.getWorkingDirectory(), myConfiguration.getDirectoryPath(), File.separatorChar); String pathSuffix = (myCoverageFilePath == null) ? "..." : "."; if (relativePath != null) { executor.withParameters("./" + relativePath + "/" + pathSuffix); } else { executor.withParameters("./" + pathSuffix); executor.withWorkDirectory(myConfiguration.getDirectoryPath()); } addFilterParameter(executor, myConfiguration.getPattern()); break; case PACKAGE: executor.withParameters(myConfiguration.getPackage()); addFilterParameter(executor, myConfiguration.getPattern()); break; case FILE: String filePath = myConfiguration.getFilePath(); VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); if (virtualFile == null) { throw new ExecutionException("Test file doesn't exist"); } PsiFile file = PsiManager.getInstance(myConfiguration.getProject()).findFile(virtualFile); if (file == null || !GoTestFinder.isTestFile(file)) { throw new ExecutionException("File '" + filePath + "' is not test file"); } String importPath = ((GoFile)file).getImportPath(); if (StringUtil.isEmpty(importPath)) { throw new ExecutionException("Cannot find import path for " + filePath); } executor.withParameters(importPath); addFilterParameter(executor, buildFilePattern((GoFile)file)); break; } if (myCoverageFilePath != null) { executor.withParameters("-coverprofile=" + myCoverageFilePath, "-covermode=atomic"); } return executor; }