浏览代码

Optimize some wrong usage and spelling

Signed-off-by: wgliang <liangcszzu@163.com>
wangguoliang 8 年之前
父节点
当前提交
652fce7e76

+ 1 - 3
pkg/api/cloudwatch/metrics.go

@@ -166,9 +166,7 @@ func handleGetNamespaces(req *cwRequest, c *middleware.Context) {
 
 	customNamespaces := req.DataSource.JsonData.Get("customMetricsNamespaces").MustString()
 	if customNamespaces != "" {
-		for _, key := range strings.Split(customNamespaces, ",") {
-			keys = append(keys, key)
-		}
+		keys = append(keys, strings.Split(customNamespaces, ",")...)
 	}
 
 	sort.Sort(sort.StringSlice(keys))

+ 1 - 1
pkg/components/dashdiffs/formatter_basic.go

@@ -231,7 +231,7 @@ func (b *BasicDiff) Basic(lines []*JSONLine) []*BasicBlock {
 // in the JSON document to a top level key.
 //
 // In order to produce distinct "blocks" when rendering the basic diff,
-// we need a way to distinguish between differnt sections of data.
+// we need a way to distinguish between different sections of data.
 // To do this, we consider the value(s) of each top-level JSON key to
 // represent a distinct block for Grafana's JSON data structure, so
 // we perform this check to see if we've entered a new "block". If we

+ 3 - 3
pkg/components/dashdiffs/formatter_json.go

@@ -302,16 +302,16 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
 	return nil
 }
 
-func (f *JSONFormatter) searchDeltas(deltas []diff.Delta, postion diff.Position) (results []diff.Delta) {
+func (f *JSONFormatter) searchDeltas(deltas []diff.Delta, position diff.Position) (results []diff.Delta) {
 	results = make([]diff.Delta, 0)
 	for _, delta := range deltas {
 		switch delta.(type) {
 		case diff.PostDelta:
-			if delta.(diff.PostDelta).PostPosition() == postion {
+			if delta.(diff.PostDelta).PostPosition() == position {
 				results = append(results, delta)
 			}
 		case diff.PreDelta:
-			if delta.(diff.PreDelta).PrePosition() == postion {
+			if delta.(diff.PreDelta).PrePosition() == position {
 				results = append(results, delta)
 			}
 		default:

+ 2 - 2
pkg/login/auth.go

@@ -33,8 +33,8 @@ func AuthenticateUser(query *LoginUserQuery) error {
 
 	if setting.LdapEnabled {
 		for _, server := range LdapCfg.Servers {
-			auther := NewLdapAuthenticator(server)
-			err = auther.Login(query)
+			author := NewLdapAuthenticator(server)
+			err = author.Login(query)
 			if err == nil || err != ErrInvalidCredentials {
 				return err
 			}

+ 3 - 3
pkg/middleware/auth_proxy.go

@@ -67,7 +67,7 @@ func initContextWithAuthProxy(ctx *Context, orgId int64) bool {
 	if getRequestUserId(ctx) > 0 && getRequestUserId(ctx) != query.Result.UserId {
 		// remove session
 		if err := ctx.Session.Destory(ctx); err != nil {
-			log.Error(3, "Failed to destory session, err")
+			log.Error(3, "Failed to destroy session, err")
 		}
 
 		// initialize a new session
@@ -107,8 +107,8 @@ var syncGrafanaUserWithLdapUser = func(ctx *Context, query *m.GetSignedInUserQue
 			ldapCfg := login.LdapCfg
 
 			for _, server := range ldapCfg.Servers {
-				auther := login.NewLdapAuthenticator(server)
-				if err := auther.SyncSignedInUser(query.Result); err != nil {
+				author := login.NewLdapAuthenticator(server)
+				if err := author.SyncSignedInUser(query.Result); err != nil {
 					return err
 				}
 			}

+ 1 - 1
pkg/tsdb/mqe/types_test.go

@@ -71,7 +71,7 @@ func TestWildcardExpansion(t *testing.T) {
 			So(expandeQueries[0].RawQuery, ShouldEqual, fmt.Sprintf("`os.cpu.3.idle`|aggregate.min|aggregate.max where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v", from, to))
 		})
 
-		Convey("Containg wildcard series", func() {
+		Convey("Containing wildcard series", func() {
 			query := &Query{
 				Metrics: []Metric{
 					{Metric: "os.cpu*", Alias: ""},