Browse Source

updated circle with fmt formating test

Torkel Ödegaard 10 years ago
parent
commit
d8005af8ee

+ 4 - 0
circle.yml

@@ -14,5 +14,9 @@ dependencies:
 
 
 test:
 test:
   override:
   override:
+     # FMT
+     - test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
+     # Go lang test
      - godep go test -v ./pkg/...
      - godep go test -v ./pkg/...
+     # js tests
      - ./node_modules/grunt-cli/bin/grunt test
      - ./node_modules/grunt-cli/bin/grunt test

+ 1 - 1
pkg/services/eventpublisher/eventpublisher.go

@@ -6,10 +6,10 @@ import (
 	"log"
 	"log"
 	"time"
 	"time"
 
 
-	"github.com/streadway/amqp"
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/events"
 	"github.com/grafana/grafana/pkg/events"
 	"github.com/grafana/grafana/pkg/setting"
 	"github.com/grafana/grafana/pkg/setting"
+	"github.com/streadway/amqp"
 )
 )
 
 
 var (
 var (

+ 20 - 20
pkg/services/sqlstore/migrations/apikey_mig.go

@@ -6,18 +6,18 @@ func addApiKeyMigrations(mg *Migrator) {
 	apiKeyV1 := Table{
 	apiKeyV1 := Table{
 		Name: "api_key",
 		Name: "api_key",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "account_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "key", Type: DB_Varchar, Length: 64, Nullable: false},
-			&Column{Name: "role", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "account_id", Type: DB_BigInt, Nullable: false},
+			{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "key", Type: DB_Varchar, Length: 64, Nullable: false},
+			{Name: "role", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"account_id"}},
-			&Index{Cols: []string{"key"}, Type: UniqueIndex},
-			&Index{Cols: []string{"account_id", "name"}, Type: UniqueIndex},
+			{Cols: []string{"account_id"}},
+			{Cols: []string{"key"}, Type: UniqueIndex},
+			{Cols: []string{"account_id", "name"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 
@@ -39,18 +39,18 @@ func addApiKeyMigrations(mg *Migrator) {
 	apiKeyV2 := Table{
 	apiKeyV2 := Table{
 		Name: "api_key",
 		Name: "api_key",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "org_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "key", Type: DB_Varchar, Length: 64, Nullable: false},
-			&Column{Name: "role", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "org_id", Type: DB_BigInt, Nullable: false},
+			{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "key", Type: DB_Varchar, Length: 64, Nullable: false},
+			{Name: "role", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"org_id"}},
-			&Index{Cols: []string{"key"}, Type: UniqueIndex},
-			&Index{Cols: []string{"org_id", "name"}, Type: UniqueIndex},
+			{Cols: []string{"org_id"}},
+			{Cols: []string{"key"}, Type: UniqueIndex},
+			{Cols: []string{"org_id", "name"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 

+ 24 - 24
pkg/services/sqlstore/migrations/dashboard_mig.go

@@ -6,18 +6,18 @@ func addDashboardMigration(mg *Migrator) {
 	var dashboardV1 = Table{
 	var dashboardV1 = Table{
 		Name: "dashboard",
 		Name: "dashboard",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "version", Type: DB_Int, Nullable: false},
-			&Column{Name: "slug", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "data", Type: DB_Text, Nullable: false},
-			&Column{Name: "account_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "version", Type: DB_Int, Nullable: false},
+			{Name: "slug", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "data", Type: DB_Text, Nullable: false},
+			{Name: "account_id", Type: DB_BigInt, Nullable: false},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"account_id"}},
-			&Index{Cols: []string{"account_id", "slug"}, Type: UniqueIndex},
+			{Cols: []string{"account_id"}},
+			{Cols: []string{"account_id", "slug"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 
@@ -30,12 +30,12 @@ func addDashboardMigration(mg *Migrator) {
 	dashboardTagV1 := Table{
 	dashboardTagV1 := Table{
 		Name: "dashboard_tag",
 		Name: "dashboard_tag",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "term", Type: DB_NVarchar, Length: 50, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
+			{Name: "term", Type: DB_NVarchar, Length: 50, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"dashboard_id", "term"}, Type: UniqueIndex},
+			{Cols: []string{"dashboard_id", "term"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 
@@ -54,18 +54,18 @@ func addDashboardMigration(mg *Migrator) {
 	var dashboardV2 = Table{
 	var dashboardV2 = Table{
 		Name: "dashboard",
 		Name: "dashboard",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "version", Type: DB_Int, Nullable: false},
-			&Column{Name: "slug", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "data", Type: DB_Text, Nullable: false},
-			&Column{Name: "org_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "version", Type: DB_Int, Nullable: false},
+			{Name: "slug", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "data", Type: DB_Text, Nullable: false},
+			{Name: "org_id", Type: DB_BigInt, Nullable: false},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"org_id"}},
-			&Index{Cols: []string{"org_id", "slug"}, Type: UniqueIndex},
+			{Cols: []string{"org_id"}},
+			{Cols: []string{"org_id", "slug"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 

+ 37 - 37
pkg/services/sqlstore/migrations/datasource_mig.go

@@ -6,26 +6,26 @@ func addDataSourceMigration(mg *Migrator) {
 	var tableV1 = Table{
 	var tableV1 = Table{
 		Name: "data_source",
 		Name: "data_source",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "account_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "version", Type: DB_Int, Nullable: false},
-			&Column{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "access", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "url", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "user", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "database", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "basic_auth", Type: DB_Bool, Nullable: false},
-			&Column{Name: "basic_auth_user", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "basic_auth_password", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "is_default", Type: DB_Bool, Nullable: false},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "account_id", Type: DB_BigInt, Nullable: false},
+			{Name: "version", Type: DB_Int, Nullable: false},
+			{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "access", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "url", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "user", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "database", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "basic_auth", Type: DB_Bool, Nullable: false},
+			{Name: "basic_auth_user", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "basic_auth_password", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "is_default", Type: DB_Bool, Nullable: false},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"account_id"}},
-			&Index{Cols: []string{"account_id", "name"}, Type: UniqueIndex},
+			{Cols: []string{"account_id"}},
+			{Cols: []string{"account_id", "name"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 
@@ -45,27 +45,27 @@ func addDataSourceMigration(mg *Migrator) {
 	var tableV2 = Table{
 	var tableV2 = Table{
 		Name: "data_source",
 		Name: "data_source",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "org_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "version", Type: DB_Int, Nullable: false},
-			&Column{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "access", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "url", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "user", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "database", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "basic_auth", Type: DB_Bool, Nullable: false},
-			&Column{Name: "basic_auth_user", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "basic_auth_password", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "is_default", Type: DB_Bool, Nullable: false},
-			&Column{Name: "json_data", Type: DB_Text, Nullable: true},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "org_id", Type: DB_BigInt, Nullable: false},
+			{Name: "version", Type: DB_Int, Nullable: false},
+			{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "access", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "url", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "user", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "database", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "basic_auth", Type: DB_Bool, Nullable: false},
+			{Name: "basic_auth_user", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "basic_auth_password", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "is_default", Type: DB_Bool, Nullable: false},
+			{Name: "json_data", Type: DB_Text, Nullable: true},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"org_id"}},
-			&Index{Cols: []string{"org_id", "name"}, Type: UniqueIndex},
+			{Cols: []string{"org_id"}},
+			{Cols: []string{"org_id", "name"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 

+ 10 - 10
pkg/services/sqlstore/migrations/migrations.go

@@ -21,12 +21,12 @@ func addMigrationLogMigrations(mg *Migrator) {
 	migrationLogV1 := Table{
 	migrationLogV1 := Table{
 		Name: "migration_log",
 		Name: "migration_log",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "migration_id", Type: DB_NVarchar, Length: 255},
-			&Column{Name: "sql", Type: DB_Text},
-			&Column{Name: "success", Type: DB_Bool},
-			&Column{Name: "error", Type: DB_Text},
-			&Column{Name: "timestamp", Type: DB_DateTime},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "migration_id", Type: DB_NVarchar, Length: 255},
+			{Name: "sql", Type: DB_Text},
+			{Name: "success", Type: DB_Bool},
+			{Name: "error", Type: DB_Text},
+			{Name: "timestamp", Type: DB_DateTime},
 		},
 		},
 	}
 	}
 
 
@@ -37,12 +37,12 @@ func addStarMigrations(mg *Migrator) {
 	starV1 := Table{
 	starV1 := Table{
 		Name: "star",
 		Name: "star",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "user_id", Type: DB_BigInt, Nullable: false},
-			&Column{Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "user_id", Type: DB_BigInt, Nullable: false},
+			{Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"user_id", "dashboard_id"}, Type: UniqueIndex},
+			{Cols: []string{"user_id", "dashboard_id"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 

+ 21 - 21
pkg/services/sqlstore/migrations/org_mig.go

@@ -6,21 +6,21 @@ func addOrgMigrations(mg *Migrator) {
 	orgV1 := Table{
 	orgV1 := Table{
 		Name: "org",
 		Name: "org",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "version", Type: DB_Int, Nullable: false},
-			&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
-			&Column{Name: "address1", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "address2", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "city", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "state", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "zip_code", Type: DB_NVarchar, Length: 50, Nullable: true},
-			&Column{Name: "country", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "billing_email", Type: DB_NVarchar, Length: 255, Nullable: true},
-			&Column{Name: "created", Type: DB_DateTime, Nullable: false},
-			&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "version", Type: DB_Int, Nullable: false},
+			{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
+			{Name: "address1", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "address2", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "city", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "state", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "zip_code", Type: DB_NVarchar, Length: 50, Nullable: true},
+			{Name: "country", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "billing_email", Type: DB_NVarchar, Length: 255, Nullable: true},
+			{Name: "created", Type: DB_DateTime, Nullable: false},
+			{Name: "updated", Type: DB_DateTime, Nullable: false},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"name"}, Type: UniqueIndex},
+			{Cols: []string{"name"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}
 
 
@@ -31,16 +31,16 @@ func addOrgMigrations(mg *Migrator) {
 	orgUserV1 := Table{
 	orgUserV1 := Table{
 		Name: "org_user",
 		Name: "org_user",
 		Columns: []*Column{
 		Columns: []*Column{
-			&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
-			&Column{Name: "org_id", Type: DB_BigInt},
-			&Column{Name: "user_id", Type: DB_BigInt},
-			&Column{Name: "role", Type: DB_NVarchar, Length: 20},
-			&Column{Name: "created", Type: DB_DateTime},
-			&Column{Name: "updated", Type: DB_DateTime},
+			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
+			{Name: "org_id", Type: DB_BigInt},
+			{Name: "user_id", Type: DB_BigInt},
+			{Name: "role", Type: DB_NVarchar, Length: 20},
+			{Name: "created", Type: DB_DateTime},
+			{Name: "updated", Type: DB_DateTime},
 		},
 		},
 		Indices: []*Index{
 		Indices: []*Index{
-			&Index{Cols: []string{"org_id"}},
-			&Index{Cols: []string{"org_id", "user_id"}, Type: UniqueIndex},
+			{Cols: []string{"org_id"}},
+			{Cols: []string{"org_id", "user_id"}, Type: UniqueIndex},
 		},
 		},
 	}
 	}