fix windows issue

This commit is contained in:
lyyyuna 2020-09-13 10:12:30 +08:00
parent 6c70842e55
commit 8b2b1f0784
3 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "goc", "name": "goc",
"version": "0.0.3", "version": "0.0.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -996,6 +996,11 @@
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
}, },
"upath": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="
},
"vscode-test": { "vscode-test": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.4.0.tgz", "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.4.0.tgz",

View File

@ -2,7 +2,7 @@
"name": "goc", "name": "goc",
"displayName": "Goc Coverage", "displayName": "Goc Coverage",
"description": "Goc Coverage can display coverage vairation in real time. Goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scenarios, like system testing code coverage collection and accurate testing.", "description": "Goc Coverage can display coverage vairation in real time. Goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scenarios, like system testing code coverage collection and accurate testing.",
"version": "0.0.4", "version": "0.0.5",
"publisher": "lyyyuna", "publisher": "lyyyuna",
"repository": { "repository": {
"url": "https://github.com/qiniu/goc" "url": "https://github.com/qiniu/goc"
@ -61,6 +61,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"log4js": "^6.3.0" "log4js": "^6.3.0",
"upath": "^1.2.0"
} }
} }

View File

@ -5,6 +5,7 @@ import { spawnSync } from 'child_process';
import * as path from 'path'; import * as path from 'path';
import { promisify } from 'util'; import { promisify } from 'util';
import * as log4js from 'log4js'; import * as log4js from 'log4js';
import * as upath from 'upath';
const sleep = promisify(setTimeout); const sleep = promisify(setTimeout);
export class GocServer { export class GocServer {
@ -100,7 +101,7 @@ export class GocServer {
this._logger.error("no workspace found"); this._logger.error("no workspace found");
return []; return [];
} else { } else {
cwd = workspaces[0].uri.path; cwd = workspaces[0].uri.fsPath;
} }
this._logger.debug('current project root directory: ', cwd); this._logger.debug('current project root directory: ', cwd);
let opts = { let opts = {
@ -160,6 +161,9 @@ export class GocServer {
let importPath: string = line.split(':')[0]; let importPath: string = line.split(':')[0];
let blockInfo: string = line.split(':')[1]; let blockInfo: string = line.split(':')[1];
// on windows the path is different from posix
// needs transform
importPathNeedsRender = upath.toUnix(importPathNeedsRender)
if (importPath != importPathNeedsRender) { if (importPath != importPathNeedsRender) {
continue; continue;
} }