summaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-24 15:04:31 +0800
committerGitHub <noreply@github.com>2016-11-24 15:04:31 +0800
commit3917ed45de063b4e8868610c82d8172020d572fd (patch)
tree052b7651cbb64ae30f92efe87441ad1d4fa2d922 /routers/repo/download.go
parent3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff)
downloadgitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz
gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip
golint fixed for routers (#208)
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 654cc01399..3adab315d4 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/context"
)
+// ServeData download file from io.Reader
func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf := make([]byte, 1024)
n, _ := reader.Read(buf)
@@ -34,6 +35,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
return err
}
+// ServeBlob download a git.Blob
func ServeBlob(ctx *context.Context, blob *git.Blob) error {
dataRc, err := blob.Data()
if err != nil {
@@ -43,6 +45,7 @@ func ServeBlob(ctx *context.Context, blob *git.Blob) error {
return ServeData(ctx, ctx.Repo.TreePath, dataRc)
}
+// SingleDownload download a file by repos path
func SingleDownload(ctx *context.Context) {
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath)
if err != nil {