-1

我正在尝试在我的项目中的所有包中获得测试覆盖率。

当我执行以下命令时,测试正在成功执行并报告覆盖率。

go test -cover ./...

go test但是当我使用coverpkg=./...参数执行时所有测试都失败了

go test -cover -coverpkg=./... ./...

这是命令的示例输出

srimal@srimal-pc:~/projects/myproject$ go test -v -cover -coverpkg=./... ./...
go build a.abc.com/path/to/module/e2e: no non-test Go files in /home/srimal/projects/driver-selection-handler/e2e
?       a.abc.com/path/to/module      [no test files]
?       a.abc.com/path/to/module/app  [no test files]
?       a.abc.com/path/to/module/constrain    [no test files]
FAIL    a.abc.com/path/to/module/directionalhire [build failed]
?       a.abc.com/path/to/module/domain       [no test files]
FAIL    a.abc.com/path/to/module/durationmatrix [build failed]
FAIL    a.abc.com/path/to/module/durationmatrix/etaservice [build failed]
FAIL    a.abc.com/path/to/module/durationmatrix/roadmatrix [build failed]
2021/04/22 17:23:07 go-util/log: Cannot open config file  open config/logger.yaml: no such file or directory
testing: warning: no tests to run
PASS
coverage: 0.0% of statements in ./...
ok      a.abc.com/path/to/module/e2e  (cached)        coverage: 0.0% of statements in ./... [no tests to run]
?       a.abc.com/path/to/module/events       [no test files]
FAIL    a.abc.com/path/to/module/finance [build failed]
?       a.abc.com/path/to/module/internal     [no test files]
?       a.abc.com/path/to/module/internal/config      [no test files]
?       a.abc.com/path/to/module/internal/logger      [no test files]
?       a.abc.com/path/to/module/internal/metrics     [no test files]
?       a.abc.com/path/to/module/internal/profiling   [no test files]
?       a.abc.com/path/to/module/internal/schema      [no test files]
?       a.abc.com/path/to/module/internal/stream      [no test files]
FAIL    a.abc.com/path/to/module/location [build failed]
?       a.abc.com/path/to/module/logger       [no test files]
?       a.abc.com/path/to/module/metrics      [no test files]
FAIL    a.abc.com/path/to/module/selection [build failed]
FAIL    a.abc.com/path/to/module/store [build failed]
FAIL    a.abc.com/path/to/module/stream [build failed]
?       a.abc.com/path/to/module/stream/reg   [no test files]
FAIL    a.abc.com/path/to/module/weighted [build failed]

我正在使用 go 版本 1.15.6

有没有办法找到构建失败的原因?

4

1 回答 1

0

有没有办法找到构建失败的原因?

单独构建(或测试)包。

于 2021-04-22T18:09:46.423 回答