mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
linter: Enable gofumpt and run against codebase (#1848)
* linter: Enable gofumpt and run against codebase * Address shazbert's nits * gofumpt: Fix issues after rebase
This commit is contained in:
@@ -29,14 +29,14 @@ func Event(id, msgtype, message string) {
|
||||
}
|
||||
|
||||
if repository.GetSQLDialect() == database.DBSQLite3 {
|
||||
var tempEvent = modelSQLite.AuditEvent{
|
||||
tempEvent := modelSQLite.AuditEvent{
|
||||
Type: msgtype,
|
||||
Identifier: id,
|
||||
Message: message,
|
||||
}
|
||||
err = tempEvent.Insert(ctx, tx, boil.Blacklist("created_at"))
|
||||
} else {
|
||||
var tempEvent = modelPSQL.AuditEvent{
|
||||
tempEvent := modelPSQL.AuditEvent{
|
||||
Type: msgtype,
|
||||
Identifier: id,
|
||||
Message: message,
|
||||
|
||||
@@ -219,7 +219,7 @@ func Insert(in *Item) (uint64, error) {
|
||||
func insertSQLite(ctx context.Context, tx *sql.Tx, in *Item) (uint64, error) {
|
||||
var totalInserted uint64
|
||||
for x := range in.Candles {
|
||||
var tempCandle = modelSQLite.Candle{
|
||||
tempCandle := modelSQLite.Candle{
|
||||
ExchangeNameID: in.ExchangeID,
|
||||
Base: strings.ToUpper(in.Base),
|
||||
Quote: strings.ToUpper(in.Quote),
|
||||
@@ -254,7 +254,7 @@ func insertSQLite(ctx context.Context, tx *sql.Tx, in *Item) (uint64, error) {
|
||||
func insertPostgresSQL(ctx context.Context, tx *sql.Tx, in *Item) (uint64, error) {
|
||||
var totalInserted uint64
|
||||
for x := range in.Candles {
|
||||
var tempCandle = modelPSQL.Candle{
|
||||
tempCandle := modelPSQL.Candle{
|
||||
ExchangeNameID: in.ExchangeID,
|
||||
Base: strings.ToUpper(in.Base),
|
||||
Quote: strings.ToUpper(in.Quote),
|
||||
|
||||
@@ -246,7 +246,7 @@ func upsertSqlite(ctx context.Context, tx *sql.Tx, jobs ...*DataHistoryJob) erro
|
||||
if jobs[i].ReplaceOnIssue {
|
||||
replaceOnIssue = 1
|
||||
}
|
||||
var tempEvent = sqlite3.Datahistoryjob{
|
||||
tempEvent := sqlite3.Datahistoryjob{
|
||||
ID: jobs[i].ID,
|
||||
ExchangeNameID: exch.ID,
|
||||
Nickname: strings.ToLower(jobs[i].Nickname),
|
||||
@@ -297,7 +297,7 @@ func upsertPostgres(ctx context.Context, tx *sql.Tx, jobs ...*DataHistoryJob) er
|
||||
}
|
||||
}
|
||||
|
||||
var tempEvent = postgres.Datahistoryjob{
|
||||
tempEvent := postgres.Datahistoryjob{
|
||||
ID: jobs[i].ID,
|
||||
Nickname: strings.ToLower(jobs[i].Nickname),
|
||||
ExchangeNameID: exch.ID,
|
||||
@@ -330,6 +330,7 @@ func upsertPostgres(ctx context.Context, tx *sql.Tx, jobs ...*DataHistoryJob) er
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *DBService) getByNicknameSQLite(nickname string) (*DataHistoryJob, error) {
|
||||
result, err := sqlite3.Datahistoryjobs(qm.Where("nickname = ?", strings.ToLower(nickname))).One(context.TODO(), db.sql)
|
||||
if err != nil {
|
||||
|
||||
@@ -116,7 +116,7 @@ func upsertSqlite(ctx context.Context, tx *sql.Tx, results ...*DataHistoryJobRes
|
||||
results[i].ID = freshUUID.String()
|
||||
}
|
||||
|
||||
var tempEvent = sqlite3.Datahistoryjobresult{
|
||||
tempEvent := sqlite3.Datahistoryjobresult{
|
||||
ID: results[i].ID,
|
||||
JobID: results[i].JobID,
|
||||
Result: null.NewString(results[i].Result, results[i].Result != ""),
|
||||
@@ -145,7 +145,7 @@ func upsertPostgres(ctx context.Context, tx *sql.Tx, results ...*DataHistoryJobR
|
||||
}
|
||||
results[i].ID = freshUUID.String()
|
||||
}
|
||||
var tempEvent = postgres.Datahistoryjobresult{
|
||||
tempEvent := postgres.Datahistoryjobresult{
|
||||
ID: results[i].ID,
|
||||
JobID: results[i].JobID,
|
||||
Result: null.NewString(results[i].Result, results[i].Result != ""),
|
||||
|
||||
@@ -138,7 +138,7 @@ func insertSQLite(ctx context.Context, tx *sql.Tx, in []Details) (err error) {
|
||||
if errUUID != nil {
|
||||
return errUUID
|
||||
}
|
||||
var tempInsert = modelSQLite.Exchange{
|
||||
tempInsert := modelSQLite.Exchange{
|
||||
Name: strings.ToLower(in[x].Name),
|
||||
ID: tempUUID.String(),
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func insertSQLite(ctx context.Context, tx *sql.Tx, in []Details) (err error) {
|
||||
|
||||
func insertPostgresql(ctx context.Context, tx *sql.Tx, in []Details) (err error) {
|
||||
for x := range in {
|
||||
var tempInsert = modelPSQL.Exchange{
|
||||
tempInsert := modelPSQL.Exchange{
|
||||
Name: strings.ToLower(in[x].Name),
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ func Event(id, name, path string, data null.Bytes, executionType, status string,
|
||||
}
|
||||
return
|
||||
}
|
||||
var tempEvent = modelSQLite.Script{}
|
||||
tempEvent := modelSQLite.Script{}
|
||||
if !f {
|
||||
newUUID, errUUID := uuid.NewV4()
|
||||
if errUUID != nil {
|
||||
@@ -82,7 +82,7 @@ func Event(id, name, path string, data null.Bytes, executionType, status string,
|
||||
return
|
||||
}
|
||||
} else {
|
||||
var tempEvent = modelPSQL.Script{
|
||||
tempEvent := modelPSQL.Script{
|
||||
ScriptID: id,
|
||||
ScriptName: name,
|
||||
ScriptPath: path,
|
||||
|
||||
@@ -13,9 +13,7 @@ import (
|
||||
"github.com/volatiletech/null"
|
||||
)
|
||||
|
||||
var (
|
||||
verbose = false
|
||||
)
|
||||
var verbose = false
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
@@ -154,7 +154,7 @@ func insertSQLite(ctx context.Context, tx *sql.Tx, trades ...Data) error {
|
||||
}
|
||||
trades[i].ID = freshUUID.String()
|
||||
}
|
||||
var tempEvent = sqlite3.Trade{
|
||||
tempEvent := sqlite3.Trade{
|
||||
ID: trades[i].ID,
|
||||
ExchangeNameID: trades[i].ExchangeNameID,
|
||||
Base: strings.ToUpper(trades[i].Base),
|
||||
@@ -190,7 +190,7 @@ func insertPostgres(ctx context.Context, tx *sql.Tx, trades ...Data) error {
|
||||
}
|
||||
trades[i].ID = freshUUID.String()
|
||||
}
|
||||
var tempEvent = postgres.Trade{
|
||||
tempEvent := postgres.Trade{
|
||||
ExchangeNameID: trades[i].ExchangeNameID,
|
||||
Base: strings.ToUpper(trades[i].Base),
|
||||
Quote: strings.ToUpper(trades[i].Quote),
|
||||
|
||||
@@ -63,7 +63,7 @@ func Event(res *withdraw.Response) {
|
||||
}
|
||||
|
||||
func addPSQLEvent(ctx context.Context, tx *sql.Tx, res *withdraw.Response) (err error) {
|
||||
var tempEvent = modelPSQL.WithdrawalHistory{
|
||||
tempEvent := modelPSQL.WithdrawalHistory{
|
||||
ExchangeNameID: res.Exchange.Name,
|
||||
ExchangeID: res.Exchange.ID,
|
||||
Status: res.Exchange.Status,
|
||||
@@ -143,7 +143,7 @@ func addSQLiteEvent(ctx context.Context, tx *sql.Tx, res *withdraw.Response) (er
|
||||
return
|
||||
}
|
||||
|
||||
var tempEvent = modelSQLite.WithdrawalHistory{
|
||||
tempEvent := modelSQLite.WithdrawalHistory{
|
||||
ID: newUUID.String(),
|
||||
ExchangeNameID: res.Exchange.Name,
|
||||
ExchangeID: res.Exchange.ID,
|
||||
@@ -289,14 +289,14 @@ func getByColumns(q []qm.QueryMod) ([]*withdraw.Response, error) {
|
||||
}
|
||||
|
||||
var resp []*withdraw.Response
|
||||
var ctx = context.Background()
|
||||
ctx := context.Background()
|
||||
if repository.GetSQLDialect() == database.DBSQLite3 {
|
||||
v, err := modelSQLite.WithdrawalHistories(q...).All(ctx, database.DB.SQL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for x := range v {
|
||||
var tempResp = &withdraw.Response{}
|
||||
tempResp := &withdraw.Response{}
|
||||
var newUUID uuid.UUID
|
||||
newUUID, err = uuid.FromString(v[x].ID)
|
||||
if err != nil {
|
||||
@@ -369,7 +369,7 @@ func getByColumns(q []qm.QueryMod) ([]*withdraw.Response, error) {
|
||||
}
|
||||
|
||||
for x := range v {
|
||||
var tempResp = &withdraw.Response{}
|
||||
tempResp := &withdraw.Response{}
|
||||
newUUID, _ := uuid.FromString(v[x].ID)
|
||||
tempResp.ID = newUUID
|
||||
tempResp.Exchange.ID = v[x].ExchangeID
|
||||
|
||||
Reference in New Issue
Block a user