Skip to content

Commit

Permalink
Add default GoDocURL value
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandregv committed Mar 24, 2024
1 parent e95f461 commit 779fa94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion goreadme.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type Config struct {
// ImportPath is used to override the import path. For example: github.com/user/project,
// github.com/user/project/package or github.com/user/project/version.
ImportPath string `json:"import_path"`
// GoDocURL is the Go Doc URL used in the GoDoc Badge.
// GoDocURL is the Go Doc URL used in the GoDoc Badge. Default: https://pkg.go.dev.
GoDocURL string `json:"godoc_url"`
// Use the standard library comment parser introduced in Go 1.19 to generate the markdown output.
StdMarkdown bool `json:"std_markdown"`
Expand Down Expand Up @@ -270,6 +270,10 @@ func (r *GoReadme) get(ctx context.Context, name string) (*pkg, error) {
p.ImportPath = override
}

if override := r.config.GoDocURL; override == "" {
r.config.GoDocURL = "https://pkg.go.dev"
}

pkg := &pkg{
Package: p,
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/pkg4_badges/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/./testdata/pkg4_badges.svg?branch=master)](https://travis-ci.org/./testdata/pkg4_badges)
[![codecov](https://codecov.io/gh/./testdata/pkg4_badges/branch/master/graph/badge.svg)](https://codecov.io/gh/./testdata/pkg4_badges)
[![golangci](https://golangci.com/badges/./testdata/pkg4_badges.svg)](https://golangci.com/r/./testdata/pkg4_badges)
[![GoDoc](https://img.shields.io/badge/pkg.go.dev-doc-blue)](http://pkg.go.dev/./testdata/pkg4_badges)
[![GoDoc](https://pkg.go.dev/badge/pkgsite/pkg.svg)](https://pkg.go.dev/./testdata/pkg4_badges)
[![Go Report Card](https://goreportcard.com/badge/./testdata/pkg4_badges)](https://goreportcard.com/report/./testdata/pkg4_badges)

Package pkg4 tests badges.

0 comments on commit 779fa94

Please sign in to comment.