From d8005af8ee854af5569b5aa9f067d7a1342341a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 7 Mar 2015 16:23:22 +0100 Subject: [PATCH] updated circle with fmt formating test --- circle.yml | 4 + pkg/services/eventpublisher/eventpublisher.go | 2 +- .../sqlstore/migrations/apikey_mig.go | 40 +++++----- .../sqlstore/migrations/dashboard_mig.go | 48 ++++++------ .../sqlstore/migrations/datasource_mig.go | 74 +++++++++---------- .../sqlstore/migrations/migrations.go | 20 ++--- pkg/services/sqlstore/migrations/org_mig.go | 42 +++++------ 7 files changed, 117 insertions(+), 113 deletions(-) diff --git a/circle.yml b/circle.yml index 9c9802f950a..f1b151a8e41 100644 --- a/circle.yml +++ b/circle.yml @@ -14,5 +14,9 @@ dependencies: test: override: + # FMT + - test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" + # Go lang test - godep go test -v ./pkg/... + # js tests - ./node_modules/grunt-cli/bin/grunt test diff --git a/pkg/services/eventpublisher/eventpublisher.go b/pkg/services/eventpublisher/eventpublisher.go index fa7fe500443..14e527b2cc7 100644 --- a/pkg/services/eventpublisher/eventpublisher.go +++ b/pkg/services/eventpublisher/eventpublisher.go @@ -6,10 +6,10 @@ import ( "log" "time" - "github.com/streadway/amqp" "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/events" "github.com/grafana/grafana/pkg/setting" + "github.com/streadway/amqp" ) var ( diff --git a/pkg/services/sqlstore/migrations/apikey_mig.go b/pkg/services/sqlstore/migrations/apikey_mig.go index 1b2dc433941..e25b57c77ef 100644 --- a/pkg/services/sqlstore/migrations/apikey_mig.go +++ b/pkg/services/sqlstore/migrations/apikey_mig.go @@ -6,18 +6,18 @@ func addApiKeyMigrations(mg *Migrator) { apiKeyV1 := Table{ Name: "api_key", 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{ - &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{ Name: "api_key", 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{ - &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}, }, } diff --git a/pkg/services/sqlstore/migrations/dashboard_mig.go b/pkg/services/sqlstore/migrations/dashboard_mig.go index d1579a8da2a..6ded17ff0e7 100644 --- a/pkg/services/sqlstore/migrations/dashboard_mig.go +++ b/pkg/services/sqlstore/migrations/dashboard_mig.go @@ -6,18 +6,18 @@ func addDashboardMigration(mg *Migrator) { var dashboardV1 = Table{ Name: "dashboard", 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{ - &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{ Name: "dashboard_tag", 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{ - &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{ Name: "dashboard", 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{ - &Index{Cols: []string{"org_id"}}, - &Index{Cols: []string{"org_id", "slug"}, Type: UniqueIndex}, + {Cols: []string{"org_id"}}, + {Cols: []string{"org_id", "slug"}, Type: UniqueIndex}, }, } diff --git a/pkg/services/sqlstore/migrations/datasource_mig.go b/pkg/services/sqlstore/migrations/datasource_mig.go index efa75c891ad..924e1a16189 100644 --- a/pkg/services/sqlstore/migrations/datasource_mig.go +++ b/pkg/services/sqlstore/migrations/datasource_mig.go @@ -6,26 +6,26 @@ func addDataSourceMigration(mg *Migrator) { var tableV1 = Table{ Name: "data_source", 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{ - &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{ Name: "data_source", 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{ - &Index{Cols: []string{"org_id"}}, - &Index{Cols: []string{"org_id", "name"}, Type: UniqueIndex}, + {Cols: []string{"org_id"}}, + {Cols: []string{"org_id", "name"}, Type: UniqueIndex}, }, } diff --git a/pkg/services/sqlstore/migrations/migrations.go b/pkg/services/sqlstore/migrations/migrations.go index 963088ca0d9..c48167d97e5 100644 --- a/pkg/services/sqlstore/migrations/migrations.go +++ b/pkg/services/sqlstore/migrations/migrations.go @@ -21,12 +21,12 @@ func addMigrationLogMigrations(mg *Migrator) { migrationLogV1 := Table{ Name: "migration_log", 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{ Name: "star", 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{ - &Index{Cols: []string{"user_id", "dashboard_id"}, Type: UniqueIndex}, + {Cols: []string{"user_id", "dashboard_id"}, Type: UniqueIndex}, }, } diff --git a/pkg/services/sqlstore/migrations/org_mig.go b/pkg/services/sqlstore/migrations/org_mig.go index 4935955c4f5..8e25da76b58 100644 --- a/pkg/services/sqlstore/migrations/org_mig.go +++ b/pkg/services/sqlstore/migrations/org_mig.go @@ -6,21 +6,21 @@ func addOrgMigrations(mg *Migrator) { orgV1 := Table{ Name: "org", 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{ - &Index{Cols: []string{"name"}, Type: UniqueIndex}, + {Cols: []string{"name"}, Type: UniqueIndex}, }, } @@ -31,16 +31,16 @@ func addOrgMigrations(mg *Migrator) { orgUserV1 := Table{ Name: "org_user", 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{ - &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}, }, }