Skip to content

Commit

Permalink
Release 2.0.1
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
jpoles1 committed Jul 15, 2018
1 parent 057d5e4 commit 9e83678
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GopherBadger
### Generate coverage badge images using Go!

![gopherbadger-tag-do-not-edit](https://img.shields.io/badge/Go Coverage-73%25-brightgreen.png?longCache=true&style=flat)
![gopherbadger-tag-do-not-edit](https://img.shields.io/badge/Go%20Coverage-73%25-brightgreen.svg?longCache=true&style=flat)

One day, I noticed that there was no easy way to generate coverage badges for my Golang projects. So I made one (see above)!

Expand Down
Binary file modified coverage_badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion coverbadge/coverbadge.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Badge struct {

func (badge Badge) generateBadgeBadgeURL(coverageFloat float64) string {
if badge.CoveragePrefix != "" {
badge.CoveragePrefix += " "
badge.CoveragePrefix += "%20"
}
urlTemplate := "https://img.shields.io/badge/%sCoverage-%2.f%%25-brightgreen%s?longCache=true&style=%s"
return fmt.Sprintf(urlTemplate, badge.CoveragePrefix, coverageFloat, badge.ImageExtension, badge.Style)
Expand Down Expand Up @@ -52,6 +52,7 @@ func (badge Badge) DownloadBadge(filepath string, coverageFloat float64) {
}

func (badge Badge) WriteBadgeToMd(filepath string, coverageFloat float64) {
badge.ImageExtension = ".svg"
badgeURL := badge.generateBadgeBadgeURL(coverageFloat)
newImageTag := fmt.Sprintf("![gopherbadger-tag-do-not-edit](%s)", badgeURL)
imageTagRegex := `\!?\[gopherbadger-tag-do-not-edit\](.*)`
Expand Down

0 comments on commit 9e83678

Please sign in to comment.