Rename Codeowners() to CodeOwners()
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 27 Feb 2022 18:40:07 +0000 (19:40 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 27 Feb 2022 18:40:07 +0000 (19:40 +0100)
hugolib/codeowners.go
hugolib/hugo_sites.go
hugolib/page.go
hugolib/page_test.go
resources/page/page.go
resources/page/page_nop.go
resources/page/testhelpers_test.go

index 77068f1eb81fe1d6050a9e1e596eb805d2d6051b..17e956981e7376f61ed5e0046d8c1ca6def9b886 100644 (file)
@@ -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")
 
@@ -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
        }
index 662ba19d3a3bd2e26c0e7289fd7b711857b92932..9d577a285e125f45bc75ee5a54bd264a0d4f90d6 100644 (file)
@@ -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 {
index 7101af8143fdc21ae8d3203fefcb9fabb7b804c2..175e1fc3b0c0c1874fe2515fb6e066a547167289 100644 (file)
@@ -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
 }
 
index 04ca696c8d639b054e6580a51f703f6d6fc3f416..637ac46f77a72ffded1f8a410efe13a6f1bc69fa 100644 (file)
@@ -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) {
index 797322717caea5d8024d384b3ce01487860f86bb..d6869493700800e646d9b51d4b1ceab71ca12482 100644 (file)
@@ -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.
index 641c34d41bf6be5326a1c13cfc32fd41cc42b8d4..52345ad714271c5730314dd3f7c56a63fda76e6f 100644 (file)
@@ -194,7 +194,7 @@ func (p *nopPage) GitInfo() *gitmap.GitInfo {
        return nil
 }
 
-func (p *nopPage) Codeowners() []string {
+func (p *nopPage) CodeOwners() []string {
        return nil
 }
 
index 1aa80e2bb2ca121104f24fc5cd4ce74781b154d6..a655d3da94985b8a7c12d7c348eb5f8ab62e72fe 100644 (file)
@@ -252,7 +252,7 @@ func (p *testPage) GitInfo() *gitmap.GitInfo {
        return nil
 }
 
-func (p *testPage) Codeowners() []string {
+func (p *testPage) CodeOwners() []string {
        return nil
 }