Skip to content

Commit

Permalink
Rename Codeowners() to CodeOwners()
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Feb 27, 2022
1 parent 5f67151 commit cff1414
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions hugolib/codeowners.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

var afs = afero.NewOsFs()

func findCodeownersFile(dir string) (io.Reader, error) {
func findCodeOwnersFile(dir string) (io.Reader, error) {
for _, p := range []string{".", "docs", ".github", ".gitlab"} {
f := path.Join(dir, p, "CODEOWNERS")

Expand All @@ -52,10 +52,10 @@ func (c *codeownerInfo) forPage(p page.Page) []string {
return c.owners.Owners(p.File().Filename())
}

func newCodeowners(cfg config.Provider) (*codeownerInfo, error) {
func newCodeOwners(cfg config.Provider) (*codeownerInfo, error) {
workingDir := cfg.GetString("workingDir")

r, err := findCodeownersFile(workingDir)
r, err := findCodeOwnersFile(workingDir)
if err != nil || r == nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion hugolib/hugo_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (h *HugoSites) loadGitInfo() error {
h.gitInfo = gi
}

co, err := newCodeowners(h.Cfg)
co, err := newCodeOwners(h.Cfg)
if err != nil {
h.Log.Errorln("Failed to read CODEOWNERS:", err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (p *pageState) GitInfo() *gitmap.GitInfo {
return p.gitInfo
}

func (p *pageState) Codeowners() []string {
func (p *pageState) CodeOwners() []string {
return p.codeowners
}

Expand Down
4 changes: 2 additions & 2 deletions hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1074,14 +1074,14 @@ func TestPageWithLastmodFromGitInfo(t *testing.T) {

// 2018-03-11 is the Git author date for testsite/content/first-post.md
c.Assert(enSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-03-11")
c.Assert(enSite.RegularPages()[0].Codeowners()[0], qt.Equals, "@bep")
c.Assert(enSite.RegularPages()[0].CodeOwners()[0], qt.Equals, "@bep")

nnSite := h.Sites[1]
c.Assert(len(nnSite.RegularPages()), qt.Equals, 1)

// 2018-08-11 is the Git author date for testsite/content_nn/first-post.md
c.Assert(nnSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-08-11")
c.Assert(enSite.RegularPages()[0].Codeowners()[0], qt.Equals, "@bep")
c.Assert(enSite.RegularPages()[0].CodeOwners()[0], qt.Equals, "@bep")
}

func TestPageWithFrontMatterConfig(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion resources/page/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type GetPageProvider interface {
// GitInfoProvider provides Git info.
type GitInfoProvider interface {
GitInfo() *gitmap.GitInfo
Codeowners() []string
CodeOwners() []string
}

// InSectionPositioner provides section navigation.
Expand Down
2 changes: 1 addition & 1 deletion resources/page/page_nop.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (p *nopPage) GitInfo() *gitmap.GitInfo {
return nil
}

func (p *nopPage) Codeowners() []string {
func (p *nopPage) CodeOwners() []string {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion resources/page/testhelpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (p *testPage) GitInfo() *gitmap.GitInfo {
return nil
}

func (p *testPage) Codeowners() []string {
func (p *testPage) CodeOwners() []string {
return nil
}

Expand Down

0 comments on commit cff1414

Please sign in to comment.