mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
serve badge assets directly
This commit is contained in:
@@ -43,17 +43,7 @@ func grade(percentage float64) Grade {
|
||||
}
|
||||
|
||||
func badgeURL(grade Grade, style string) string {
|
||||
colorMap := map[Grade]string{
|
||||
GradeAPlus: "brightgreen",
|
||||
GradeA: "brightgreen",
|
||||
GradeB: "yellowgreen",
|
||||
GradeC: "yellow",
|
||||
GradeD: "orange",
|
||||
GradeE: "red",
|
||||
GradeF: "red",
|
||||
}
|
||||
url := fmt.Sprintf("https://img.shields.io/badge/go_report-%s-%s.svg?style=%s", grade, colorMap[grade], style)
|
||||
return url
|
||||
return fmt.Sprintf("https://goreportcard.com/assets/badges/%s_%s.svg", grade, style)
|
||||
}
|
||||
|
||||
// BadgeHandler handles fetching the badge images
|
||||
|
||||
Reference in New Issue
Block a user