Skip to content

Commit ebad9cb

Browse files
committed
Fixed gofmt formating, updated precommit hook
1 parent d8005af commit ebad9cb

File tree

3 files changed

+40
-33
lines changed

3 files changed

+40
-33
lines changed

.hooks/pre-commit

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
4+
if [ $? -gt 0 ]; then
5+
echo "Some files aren't formatted, please run 'go fmt ./pkg/...' to format your source code before committing"
6+
exit 1
7+
fi

pkg/services/sqlstore/migrations/user_mig.go

+32-32
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ func addUserMigrations(mg *Migrator) {
66
userV1 := Table{
77
Name: "user",
88
Columns: []*Column{
9-
&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
10-
&Column{Name: "version", Type: DB_Int, Nullable: false},
11-
&Column{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
12-
&Column{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
13-
&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
14-
&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
15-
&Column{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
16-
&Column{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
17-
&Column{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
18-
&Column{Name: "account_id", Type: DB_BigInt, Nullable: false},
19-
&Column{Name: "is_admin", Type: DB_Bool, Nullable: false},
20-
&Column{Name: "created", Type: DB_DateTime, Nullable: false},
21-
&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
9+
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
10+
{Name: "version", Type: DB_Int, Nullable: false},
11+
{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
12+
{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
13+
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
14+
{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
15+
{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
16+
{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
17+
{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
18+
{Name: "account_id", Type: DB_BigInt, Nullable: false},
19+
{Name: "is_admin", Type: DB_Bool, Nullable: false},
20+
{Name: "created", Type: DB_DateTime, Nullable: false},
21+
{Name: "updated", Type: DB_DateTime, Nullable: false},
2222
},
2323
Indices: []*Index{
24-
&Index{Cols: []string{"login"}, Type: UniqueIndex},
25-
&Index{Cols: []string{"email"}, Type: UniqueIndex},
24+
{Cols: []string{"login"}, Type: UniqueIndex},
25+
{Cols: []string{"email"}, Type: UniqueIndex},
2626
},
2727
}
2828

@@ -45,25 +45,25 @@ func addUserMigrations(mg *Migrator) {
4545
userV2 := Table{
4646
Name: "user",
4747
Columns: []*Column{
48-
&Column{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
49-
&Column{Name: "version", Type: DB_Int, Nullable: false},
50-
&Column{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
51-
&Column{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
52-
&Column{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
53-
&Column{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
54-
&Column{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
55-
&Column{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
56-
&Column{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
57-
&Column{Name: "org_id", Type: DB_BigInt, Nullable: false},
58-
&Column{Name: "is_admin", Type: DB_Bool, Nullable: false},
59-
&Column{Name: "email_verified", Type: DB_Bool, Nullable: true},
60-
&Column{Name: "theme", Type: DB_NVarchar, Length: 255, Nullable: true},
61-
&Column{Name: "created", Type: DB_DateTime, Nullable: false},
62-
&Column{Name: "updated", Type: DB_DateTime, Nullable: false},
48+
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
49+
{Name: "version", Type: DB_Int, Nullable: false},
50+
{Name: "login", Type: DB_NVarchar, Length: 255, Nullable: false},
51+
{Name: "email", Type: DB_NVarchar, Length: 255, Nullable: false},
52+
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
53+
{Name: "password", Type: DB_NVarchar, Length: 255, Nullable: true},
54+
{Name: "salt", Type: DB_NVarchar, Length: 50, Nullable: true},
55+
{Name: "rands", Type: DB_NVarchar, Length: 50, Nullable: true},
56+
{Name: "company", Type: DB_NVarchar, Length: 255, Nullable: true},
57+
{Name: "org_id", Type: DB_BigInt, Nullable: false},
58+
{Name: "is_admin", Type: DB_Bool, Nullable: false},
59+
{Name: "email_verified", Type: DB_Bool, Nullable: true},
60+
{Name: "theme", Type: DB_NVarchar, Length: 255, Nullable: true},
61+
{Name: "created", Type: DB_DateTime, Nullable: false},
62+
{Name: "updated", Type: DB_DateTime, Nullable: false},
6363
},
6464
Indices: []*Index{
65-
&Index{Cols: []string{"login"}, Type: UniqueIndex},
66-
&Index{Cols: []string{"email"}, Type: UniqueIndex},
65+
{Cols: []string{"login"}, Type: UniqueIndex},
66+
{Cols: []string{"email"}, Type: UniqueIndex},
6767
},
6868
}
6969

pkg/services/sqlstore/stars_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package sqlstore
33
import (
44
"testing"
55

6-
. "github.com/smartystreets/goconvey/convey"
76
m "github.com/grafana/grafana/pkg/models"
7+
. "github.com/smartystreets/goconvey/convey"
88
)
99

1010
func TestUserStarsDataAccess(t *testing.T) {

0 commit comments

Comments
 (0)