cerrado @ 9e210f61a6259c37cc7938cf353527cf072b3eda

ref: User correct err naming
  1diff --git a/pkg/config/config.go b/pkg/config/config.go
  2index 3759b7cc65b14ec93b21b2e862e20b57248ca111..fd198086bb679225c6cc743d9df9eb2c332d0c53 100644
  3--- a/pkg/config/config.go
  4+++ b/pkg/config/config.go
  5@@ -14,9 +14,9 @@ 	"git.sr.ht/~emersion/go-scfg"
  6 )
  7 
  8 var (
  9-	ScanPathErr        = errors.New("Scan path does not exist")
 10-	RepoPathErr        = errors.New("Repository path does not exist")
 11-	InvalidPropertyErr = errors.New("Invalid property")
 12+	ErrScanPath        = errors.New("Scan path does not exist")
 13+	ErrRepoPath        = errors.New("Repository path does not exist")
 14+	ErrInvalidProperty = errors.New("Invalid property")
 15 )
 16 
 17 type (
 18@@ -113,7 +113,7 @@ // expandOnScanPath scans the scanPath for folders taking them as repositories
 19 // and applying them default configuration.
 20 func (c *ConfigurationRepository) expandOnScanPath(scanPath string, public bool) error {
 21 	if !u.FileExist(scanPath) {
 22-		return ScanPathErr
 23+		return ErrScanPath
 24 	}
 25 
 26 	entries, err := os.ReadDir(scanPath)
 27@@ -185,7 +185,7 @@ 	for _, r := range blocks {
 28 		if len(r.Params) != 1 {
 29 			return fmt.Errorf(
 30 				"Invlid number of params for repository: %w",
 31-				InvalidPropertyErr,
 32+				ErrInvalidProperty,
 33 			)
 34 		}
 35 
 36@@ -198,7 +198,7 @@ 			if len(d.Params) != 1 {
 37 				return fmt.Errorf(
 38 					"Invlid number of params for %s: %w",
 39 					d.Name,
 40-					InvalidPropertyErr,
 41+					ErrInvalidProperty,
 42 				)
 43 			}
 44 
 45diff --git a/pkg/ext/compression.go b/pkg/ext/compression.go
 46index 9e933ef22eb9cfc94962fe018fff50503e11db6e..6c7a219401a031a9bf275adee9b842e4459e978f 100644
 47--- a/pkg/ext/compression.go
 48+++ b/pkg/ext/compression.go
 49@@ -16,7 +16,7 @@ 	"github.com/klauspost/compress/zstd"
 50 )
 51 
 52 var (
 53-	invalidParamErr = errors.New("Invalid weighted param")
 54+	errInvalidParam = errors.New("Invalid weighted param")
 55 )
 56 
 57 type CompressionResponseWriter struct {
 58@@ -135,7 +135,7 @@
 59 func getWeighedValue(part string) (float64, error) {
 60 	ps := strings.SplitN(part, "=", 2)
 61 	if len(ps) != 2 {
 62-		return 0, invalidParamErr
 63+		return 0, errInvalidParam
 64 	}
 65 	if name := strings.TrimSpace(ps[0]); name == "q" {
 66 		w, err := strconv.ParseFloat(ps[1], 64)
 67@@ -145,5 +145,5 @@ 		}
 68 		return w, nil
 69 	}
 70 
 71-	return 0, invalidParamErr
 72+	return 0, errInvalidParam
 73 }
 74diff --git a/pkg/ext/router.go b/pkg/ext/router.go
 75index 5d22814e9d53c5a65f4f72c6cdf67be9f929bcbb..96da1c9399992e589bbd4fefdb0bfc78b5e59b80 100644
 76--- a/pkg/ext/router.go
 77+++ b/pkg/ext/router.go
 78@@ -34,7 +34,7 @@
 79 func wrapError(next ErrorRequestHandler) http.HandlerFunc {
 80 	return func(w http.ResponseWriter, r *http.Request) {
 81 		if err := next(w, r); err != nil {
 82-			if errors.Is(err, service.RepositoryNotFoundErr) {
 83+			if errors.Is(err, service.ErrRepositoryNotFound) {
 84 				NotFound(w)
 85 			} else {
 86 				InternalServerError(w, err)
 87diff --git a/pkg/service/git.go b/pkg/service/git.go
 88index 8e25261c1a9c931c0c953960ad1215855f648274..1d212043bc292f173d2e44ccb451871a4469f99e 100644
 89--- a/pkg/service/git.go
 90+++ b/pkg/service/git.go
 91@@ -31,7 +31,7 @@ 	}
 92 )
 93 
 94 var (
 95-	RepositoryNotFoundErr = errors.New("Repository not found")
 96+	ErrRepositoryNotFound = errors.New("Repository not found")
 97 )
 98 
 99 // TODO: make it configurable
100@@ -79,7 +79,7 @@
101 func (g *GitService) ListCommits(name, ref string, count int) ([]*object.Commit, error) {
102 	r := g.configRepo.GetByName(name)
103 	if r == nil {
104-		return nil, RepositoryNotFoundErr
105+		return nil, ErrRepositoryNotFound
106 	}
107 
108 	repo, err := git.OpenRepository(r.Path)
109@@ -97,7 +97,7 @@
110 func (g *GitService) WriteTarGZip(w io.Writer, name, ref string, prefix string) error {
111 	r := g.configRepo.GetByName(name)
112 	if r == nil {
113-		return RepositoryNotFoundErr
114+		return ErrRepositoryNotFound
115 	}
116 
117 	repo, err := git.OpenRepository(r.Path)
118@@ -124,7 +124,7 @@
119 func (g *GitService) GetTree(name, ref, path string) (*object.Tree, error) {
120 	r := g.configRepo.GetByName(name)
121 	if r == nil {
122-		return nil, RepositoryNotFoundErr
123+		return nil, ErrRepositoryNotFound
124 	}
125 
126 	repo, err := git.OpenRepository(r.Path)
127@@ -142,7 +142,7 @@
128 func (g *GitService) IsBinary(name, ref, path string) (bool, error) {
129 	r := g.configRepo.GetByName(name)
130 	if r == nil {
131-		return false, RepositoryNotFoundErr
132+		return false, ErrRepositoryNotFound
133 	}
134 
135 	repo, err := git.OpenRepository(r.Path)
136@@ -160,7 +160,7 @@
137 func (g *GitService) GetFileContent(name, ref, path string) ([]byte, error) {
138 	r := g.configRepo.GetByName(name)
139 	if r == nil {
140-		return nil, RepositoryNotFoundErr
141+		return nil, ErrRepositoryNotFound
142 	}
143 
144 	repo, err := git.OpenRepository(r.Path)
145@@ -178,7 +178,7 @@
146 func (g *GitService) GetAbout(name string) ([]byte, error) {
147 	r := g.configRepo.GetByName(name)
148 	if r == nil {
149-		return nil, RepositoryNotFoundErr
150+		return nil, ErrRepositoryNotFound
151 	}
152 
153 	repo, err := git.OpenRepository(r.Path)
154@@ -190,13 +190,18 @@ 	if err != nil {
155 		return nil, err
156 	}
157 
158-	return repo.FileContent(r.About)
159+	file, err := repo.FileContent(r.About)
160+	if err != nil {
161+		return nil, err
162+	}
163+
164+	return file, nil
165 }
166 
167 func (g *GitService) ListTags(name string) ([]*plumbing.Reference, error) {
168 	r := g.configRepo.GetByName(name)
169 	if r == nil {
170-		return nil, RepositoryNotFoundErr
171+		return nil, ErrRepositoryNotFound
172 	}
173 
174 	repo, err := git.OpenRepository(r.Path)
175@@ -209,7 +214,7 @@
176 func (g *GitService) ListBranches(name string) ([]*plumbing.Reference, error) {
177 	r := g.configRepo.GetByName(name)
178 	if r == nil {
179-		return nil, RepositoryNotFoundErr
180+		return nil, ErrRepositoryNotFound
181 	}
182 
183 	repo, err := git.OpenRepository(r.Path)
184@@ -222,7 +227,7 @@
185 func (g *GitService) GetHead(name string) (*plumbing.Reference, error) {
186 	r := g.configRepo.GetByName(name)
187 	if r == nil {
188-		return nil, RepositoryNotFoundErr
189+		return nil, ErrRepositoryNotFound
190 	}
191 
192 	repo, err := git.OpenRepository(r.Path)
193diff --git a/pkg/worker/http.go b/pkg/worker/http.go
194index 1559ba2eae04e2da705285126dca07f636498a7b..55defd7a2e25ca93f1f4813b57b4ccf0c1dc6950 100644
195--- a/pkg/worker/http.go
196+++ b/pkg/worker/http.go
197@@ -10,7 +10,7 @@ 	"net/url"
198 )
199 
200 var (
201-	UnsupportedSchemeErr = errors.New("Ivalid schema, only tcp and unix supported")
202+	ErrUnsupportedScheme = errors.New("Ivalid schema, only tcp and unix supported")
203 )
204 
205 type ServerTask struct {
206@@ -72,6 +72,6 @@ 			return nil, err
207 		}
208 		return net.Listen(u.Scheme, host)
209 	default:
210-		return nil, UnsupportedSchemeErr
211+		return nil, ErrUnsupportedScheme
212 	}
213 }