update revive to use defaults and friendly formatter

This commit is contained in:
Jeffrey Paul 2019-11-07 12:57:50 -08:00
parent 5e4e253f58
commit aaeb303558
4 changed files with 4 additions and 29 deletions

View File

@ -1,25 +0,0 @@
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 1
[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.error-return]
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.if-return]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
[rule.package-comments]
[rule.range]
[rule.receiver-naming]
[rule.time-naming]
[rule.unexported-return]
[rule.indent-error-flow]
[rule.errorf]

View File

@ -44,7 +44,7 @@ fmt:
lint: lint:
go get -u github.com/mgechev/revive go get -u github.com/mgechev/revive
revive -config .revive.toml -exclude=./vendor/... ./... || exit 1 revive -formatter friendly -exclude=./vendor/... ./... || exit 1
test: build-docker-image test: build-docker-image

View File

@ -22,10 +22,10 @@ func connectToDb() {
orm.DefaultTimeLoc = time.UTC orm.DefaultTimeLoc = time.UTC
POSTGRES_DB_URL := os.Getenv("POSTGRES_DB_URL") dbURL := os.Getenv("POSTGRES_DB_URL")
orm.RegisterDriver("postgres", orm.DRPostgres) orm.RegisterDriver("postgres", orm.DRPostgres)
orm.RegisterDataBase("default", "postgres", POSTGRES_DB_URL) orm.RegisterDataBase("default", "postgres", dbURL)
orm.SetMaxIdleConns("default", 1) orm.SetMaxIdleConns("default", 1)
orm.SetMaxOpenConns("default", 5) orm.SetMaxOpenConns("default", 5)

View File

@ -2,7 +2,7 @@ package models
import "time" import "time"
// Merps are the primary database item in merp // Merp is the data model for storing merps in the db
type Merp struct { type Merp struct {
ID int `orm:"auto;column(id)"` ID int `orm:"auto;column(id)"`
Content string `json:"content" orm:"type(jsonb);column(content)"` Content string `json:"content" orm:"type(jsonb);column(content)"`