Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
112e7f3a
Commit
112e7f3a
authored
Apr 08, 2022
by
Adam Cohen
Committed by
Nick Gaskill
Apr 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove reference to unmaintained go tool
parent
3ba77373
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
doc/user/project/merge_requests/test_coverage_visualization.md
...ser/project/merge_requests/test_coverage_visualization.md
+9
-14
No files found.
doc/user/project/merge_requests/test_coverage_visualization.md
View file @
112e7f3a
...
...
@@ -326,18 +326,13 @@ run tests:
The following
[
`.gitlab-ci.yml`
](
../../../ci/yaml/index.md
)
example for Go uses:
-
[
`go test`
](
https://go.dev/doc/tutorial/add-a-test
)
to run tests.
-
[
`gocover-cobertura`
](
https://github.com/
t-yuki
/gocover-cobertura
)
to convert Go's coverage profile into the Cobertura XML format.
-
[
`gocover-cobertura`
](
https://github.com/
boumenot
/gocover-cobertura
)
to convert Go's coverage profile into the Cobertura XML format.
This example assumes that
[
Go modules
](
https://go.dev/ref/mod
)
are being used.
Using Go modules causes paths within the coverage profile to be prefixed with your
project's module identifier, which can be found in the
`go.mod`
file. This
prefix must be removed for GitLab to parse the Cobertura XML file correctly. You can use the following
`sed`
command to remove the prefix:
```
shell
sed
-i
's;filename=\"<YOUR_MODULE_ID>/;filename=\";g'
coverage.xml
```
Replace the
`gitlab.com/my-group/my-project`
placeholder in the following example with your own module identifier to make it work.
This example assumes that
[
Go modules
](
https://go.dev/ref/mod
)
are being used. Please note that the
`-covermode count`
option does not work with the
`-race`
flag.
If you want to generate code coverage while also using the
`-race`
flag, you must switch to
`-covermode atomic`
which is slower than
`-covermode count`
. See
[
this blog post
](
https://go.dev/blog/cover
)
for more details.
```
yaml
run tests
:
...
...
@@ -345,9 +340,9 @@ run tests:
image
:
golang:1.17
script
:
-
go install
-
go test . -coverprofile=coverage.txt -covermode count
-
go
run github.com/t-yuki/gocover-cobertura < coverage.txt > coverage.xml
-
sed -i 's;filename=\"gitlab.com/my-group/my-project/;filename=\";g'
coverage.xml
-
go test .
/...
-coverprofile=coverage.txt -covermode count
-
go
get github.com/boumenot/gocover-cobertura
-
go run github.com/boumenot/gocover-cobertura < coverage.txt >
coverage.xml
artifacts
:
reports
:
cobertura
:
coverage.xml
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment