chore: add some annotations

This commit is contained in:
thinkerou 2018-09-15 13:25:13 +08:00
parent d510595aa5
commit 4c75298397
3 changed files with 12 additions and 3 deletions

View File

@ -20,7 +20,7 @@ func ConfigRuntime() {
fmt.Printf("Running with %d CPUs\n", nuCPU)
}
// StartWrokers start starsWorker by goroutine.
// StartWorkers start starsWorker by goroutine.
func StartWorkers() {
go statsWorker()
}

View File

@ -11,11 +11,15 @@ import (
"github.com/gin-gonic/gin/binding"
)
// ENV_GIN_MODE indicates enviroment name for gin mode.
const ENV_GIN_MODE = "GIN_MODE"
const (
// DebugMode indicates gin mode is debug.
DebugMode = "debug"
// ReleaseMode indicates gin mode is relase.
ReleaseMode = "release"
// TestMode indicates gin mode is test.
TestMode = "test"
)
const (
@ -42,6 +46,7 @@ func init() {
SetMode(mode)
}
// SetMode sets gin mode according to input string.
func SetMode(value string) {
switch value {
case DebugMode, "":
@ -59,14 +64,18 @@ func SetMode(value string) {
modeName = value
}
// DisableBindValidation closes the default validator.
func DisableBindValidation() {
binding.Validator = nil
}
// EnableJsonDecoderUseNumber sets true for binding.EnableDecoderUseNumberto to
// call the UseNumber method on the JSON Decoder instance.
func EnableJsonDecoderUseNumber() {
binding.EnableDecoderUseNumber = true
}
// Mode returns currently gin mode.
func Mode() string {
return modeName
}

View File

@ -46,7 +46,7 @@ type HTML struct {
var htmlContentType = []string{"text/html; charset=utf-8"}
// Instance (HTMLProduction) returns an HTML instance which it realizes Render interface..
// Instance (HTMLProduction) returns an HTML instance which it realizes Render interface.
func (r HTMLProduction) Instance(name string, data interface{}) Render {
return HTML{
Template: r.Template,
@ -55,7 +55,7 @@ func (r HTMLProduction) Instance(name string, data interface{}) Render {
}
}
// Instance (HTMLDebug) returns an HTML instance which it realizes Render interface..
// Instance (HTMLDebug) returns an HTML instance which it realizes Render interface.
func (r HTMLDebug) Instance(name string, data interface{}) Render {
return HTML{
Template: r.loadTemplate(),