diff --git a/modules/context/api.go b/modules/context/api.go
index 0da1823797..2823d696d2 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -16,6 +16,7 @@ import (
 	macaron "gopkg.in/macaron.v1"
 )
 
+// APIContext is a specific macaron context for API service
 type APIContext struct {
 	*Context
 	Org *APIOrganization
@@ -63,6 +64,7 @@ func (ctx *APIContext) SetLinkHeader(total, pageSize int) {
 	}
 }
 
+// APIContexter returns apicontext as macaron middleware
 func APIContexter() macaron.Handler {
 	return func(c *Context) {
 		ctx := &APIContext{
diff --git a/modules/context/api_org.go b/modules/context/api_org.go
index bb6d14e26e..3a2c8c559d 100644
--- a/modules/context/api_org.go
+++ b/modules/context/api_org.go
@@ -8,6 +8,7 @@ import (
 	"code.gitea.io/gitea/models"
 )
 
+// APIOrganization contains organization and team
 type APIOrganization struct {
 	Organization *models.User
 	Team         *models.Team
diff --git a/modules/context/auth.go b/modules/context/auth.go
index ff3d395541..0e5ae93a87 100644
--- a/modules/context/auth.go
+++ b/modules/context/auth.go
@@ -13,6 +13,7 @@ import (
 	macaron "gopkg.in/macaron.v1"
 )
 
+// ToggleOptions contains required or check options
 type ToggleOptions struct {
 	SignInRequired  bool
 	SignOutRequired bool
@@ -20,6 +21,7 @@ type ToggleOptions struct {
 	DisableCSRF     bool
 }
 
+// Toggle returns toggle options as middleware
 func Toggle(options *ToggleOptions) macaron.Handler {
 	return func(ctx *Context) {
 		// Cannot view any page before installation.
diff --git a/modules/context/context.go b/modules/context/context.go
index fd3798b508..0535da995a 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -40,8 +40,8 @@ type Context struct {
 	Org  *Organization
 }
 
-// HasError returns true if error occurs in form validation.
-func (ctx *Context) HasApiError() bool {
+// HasAPIError returns true if error occurs in form validation.
+func (ctx *Context) HasAPIError() bool {
 	hasErr, ok := ctx.Data["HasError"]
 	if !ok {
 		return false
@@ -49,6 +49,7 @@ func (ctx *Context) HasApiError() bool {
 	return hasErr.(bool)
 }
 
+// GetErrMsg returns error message
 func (ctx *Context) GetErrMsg() string {
 	return ctx.Data["ErrorMsg"].(string)
 }
@@ -116,6 +117,7 @@ func (ctx *Context) NotFoundOrServerError(title string, errck func(error) bool,
 	ctx.Handle(500, title, err)
 }
 
+// HandleText handles HTTP status code
 func (ctx *Context) HandleText(status int, title string) {
 	if (status/100 == 4) || (status/100 == 5) {
 		log.Error(4, "%s", title)
@@ -123,6 +125,7 @@ func (ctx *Context) HandleText(status int, title string) {
 	ctx.PlainText(status, []byte(title))
 }
 
+// ServeContent serves content to http request
 func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) {
 	modtime := time.Now()
 	for _, p := range params {
diff --git a/modules/context/org.go b/modules/context/org.go
index 50919ef97e..d31d9773a0 100644
--- a/modules/context/org.go
+++ b/modules/context/org.go
@@ -12,6 +12,7 @@ import (
 	macaron "gopkg.in/macaron.v1"
 )
 
+// Organization contains organization context
 type Organization struct {
 	IsOwner      bool
 	IsMember     bool
@@ -23,6 +24,7 @@ type Organization struct {
 	Team *models.Team
 }
 
+// HandleOrgAssignment handles organization assignment
 func HandleOrgAssignment(ctx *Context, args ...bool) {
 	var (
 		requireMember     bool
@@ -145,6 +147,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
 	}
 }
 
+// OrgAssignment returns a macaron middleware to handle organization assignment
 func OrgAssignment(args ...bool) macaron.Handler {
 	return func(ctx *Context) {
 		HandleOrgAssignment(ctx, args...)
diff --git a/modules/context/repo.go b/modules/context/repo.go
index e3683a1498..6135ac46ae 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -19,6 +19,7 @@ import (
 	macaron "gopkg.in/macaron.v1"
 )
 
+// PullRequest contains informations to make a pull request
 type PullRequest struct {
 	BaseRepo *models.Repository
 	Allowed  bool
@@ -26,6 +27,7 @@ type PullRequest struct {
 	HeadInfo string // [<user>:]<branch>
 }
 
+// Repository contains informations to operate a repository
 type Repository struct {
 	AccessMode   models.AccessMode
 	IsWatching   bool
@@ -96,6 +98,7 @@ func (r *Repository) GetEditorconfig() (*editorconfig.Editorconfig, error) {
 	return editorconfig.ParseBytes(data)
 }
 
+// RetrieveBaseRepo retrieves base repository
 func RetrieveBaseRepo(ctx *Context, repo *models.Repository) {
 	// Non-fork repository will not return error in this method.
 	if err := repo.GetBaseRepo(); err != nil {
@@ -130,6 +133,7 @@ func earlyResponseForGoGetMeta(ctx *Context) {
 		})))
 }
 
+// RepoAssignment returns a macaron to handle repository assignment
 func RepoAssignment(args ...bool) macaron.Handler {
 	return func(ctx *Context) {
 		var (
@@ -446,6 +450,7 @@ func RepoRef() macaron.Handler {
 	}
 }
 
+// RequireRepoAdmin returns a macaron middleware for requiring repository admin permission
 func RequireRepoAdmin() macaron.Handler {
 	return func(ctx *Context) {
 		if !ctx.IsSigned || (!ctx.Repo.IsAdmin() && !ctx.User.IsAdmin) {
@@ -455,6 +460,7 @@ func RequireRepoAdmin() macaron.Handler {
 	}
 }
 
+// RequireRepoWriter returns a macaron middleware for requiring repository write permission
 func RequireRepoWriter() macaron.Handler {
 	return func(ctx *Context) {
 		if !ctx.IsSigned || (!ctx.Repo.IsWriter() && !ctx.User.IsAdmin) {
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go
index 23b5b269aa..1a0c003e7f 100644
--- a/routers/api/v1/misc/markdown.go
+++ b/routers/api/v1/misc/markdown.go
@@ -14,7 +14,7 @@ import (
 // Markdown render markdown document to HTML
 // see https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document
 func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
-	if ctx.HasApiError() {
+	if ctx.HasAPIError() {
 		ctx.Error(422, "", ctx.GetErrMsg())
 		return
 	}