Skip to content

Commit

Permalink
Handle hyphens in cover var names when generating cover var names (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari authored Apr 5, 2022
1 parent 8e2bb39 commit 9952601
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Version 0.2.2
-------------
* Handle hyphens in source file names when generating cover vars

Version 0.2.1
-------------
* Make the tool as binary


Version 0.2.0
-------------
* Improve the way we handle discovering coverage variables #7
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
0.2.2
4 changes: 3 additions & 1 deletion tools/please_go/covervars/cover_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ func GenCoverVars(w io.Writer, importPath string, srcs []string) {

func coverVar(src, importPath string) string {
baseName := filepath.Base(src)
return fmt.Sprintf("%s=GoCover_%s\n", importPath, strings.ReplaceAll(baseName, ".", "_"))
varname := strings.ReplaceAll(baseName, ".", "_")
varname = strings.ReplaceAll(varname, "-", "_")
return fmt.Sprintf("%s=GoCover_%s\n", importPath, varname)
}

0 comments on commit 9952601

Please sign in to comment.