diff --git a/Makefile b/Makefile index ccb01770f5..8d028a527f 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ regulated-assets-approval-server: gxdr/xdr_generated.go: $(XDRS) go run github.com/xdrpp/goxdr/cmd/goxdr -p gxdr -enum-comments -o $@ $(XDRS) - go fmt $@ + gofmt -s -w $@ xdr/%.x: curl -Lsf -o $@ https://raw.githubusercontent.com/stellar/stellar-core/master/src/protocol-curr/$@ @@ -46,7 +46,7 @@ xdr/xdr_generated.go: $(XDRS) --namespace xdr \ --output xdr/ \ $(XDRS)' - go fmt $@ + gofmt -s -w $@ xdr: gxdr/xdr_generated.go xdr/xdr_generated.go diff --git a/exp/orderbook/graph_benchmark_test.go b/exp/orderbook/graph_benchmark_test.go index 8588a2f36a..8ad04fd401 100644 --- a/exp/orderbook/graph_benchmark_test.go +++ b/exp/orderbook/graph_benchmark_test.go @@ -268,7 +268,7 @@ func BenchmarkLiquidityPoolExpectations(b *testing.B) { func createRandomAmounts(quantity int) []xdr.Int64 { amounts := make([]xdr.Int64, quantity) - for i, _ := range amounts { + for i := range amounts { amounts[i] = xdr.Int64(1 + rand.Int63n(math.MaxInt64-100)) } return amounts diff --git a/exp/orderbook/graph_test.go b/exp/orderbook/graph_test.go index a839628f8b..6793db49b5 100644 --- a/exp/orderbook/graph_test.go +++ b/exp/orderbook/graph_test.go @@ -166,7 +166,7 @@ func assertGraphEquals(t *testing.T, a, b *OrderBookGraph) { assert.Equalf(t, len(a.liquidityPools), len(b.liquidityPools), "expected same # of liquidity pools but got %v %v", a, b) - for assetString, _ := range a.assetStringToID { + for assetString := range a.assetStringToID { asset := a.assetStringToID[assetString] otherAsset, ok := b.assetStringToID[assetString] if !ok { diff --git a/exp/services/market-tracker/calc_test.go b/exp/services/market-tracker/calc_test.go index 590336af9f..d71d0626f4 100644 --- a/exp/services/market-tracker/calc_test.go +++ b/exp/services/market-tracker/calc_test.go @@ -82,7 +82,7 @@ func TestCalcSpread(t *testing.T) { func TestCalcSpreadPctAtDepth(t *testing.T) { bids := []usdOrder{ - usdOrder{ + { xlmAmount: 100.0, usdAmount: 10.0, usdPrice: 10.0, @@ -134,17 +134,17 @@ func TestCalcBestOrderAtDepth(t *testing.T) { func TestCalcSlippageAtDepth(t *testing.T) { bids := []usdOrder{ - usdOrder{ + { xlmAmount: 1., usdAmount: 30., usdPrice: 30., }, - usdOrder{ + { xlmAmount: 1., usdAmount: 25., usdPrice: 25., }, - usdOrder{ + { xlmAmount: 1., usdAmount: 50., usdPrice: 20., @@ -152,17 +152,17 @@ func TestCalcSlippageAtDepth(t *testing.T) { } asks := []usdOrder{ - usdOrder{ + { xlmAmount: 5., usdAmount: 100., usdPrice: 20., }, - usdOrder{ + { xlmAmount: 4., usdAmount: 100., usdPrice: 25., }, - usdOrder{ + { xlmAmount: 4., usdAmount: 120., usdPrice: 30., @@ -209,17 +209,17 @@ func TestCalcAvgPriceAtDepth(t *testing.T) { func TestCalcFairValuePct(t *testing.T) { bids := []usdOrder{ - usdOrder{ + { xlmAmount: 1., usdAmount: 30., usdPrice: 30., }, - usdOrder{ + { xlmAmount: 1., usdAmount: 25., usdPrice: 25., }, - usdOrder{ + { xlmAmount: 1., usdAmount: 50., usdPrice: 20., @@ -227,17 +227,17 @@ func TestCalcFairValuePct(t *testing.T) { } asks := []usdOrder{ - usdOrder{ + { xlmAmount: 5., usdAmount: 100., usdPrice: 20., }, - usdOrder{ + { xlmAmount: 4., usdAmount: 100., usdPrice: 25., }, - usdOrder{ + { xlmAmount: 4., usdAmount: 120., usdPrice: 30., diff --git a/exp/services/market-tracker/orders_test.go b/exp/services/market-tracker/orders_test.go index 22a13774df..00c363d6b3 100644 --- a/exp/services/market-tracker/orders_test.go +++ b/exp/services/market-tracker/orders_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" ) -var badAmtOrders = []hProtocol.PriceLevel{hProtocol.PriceLevel{ +var badAmtOrders = []hProtocol.PriceLevel{{ PriceR: hProtocol.Price{ N: 4, D: 2, diff --git a/exp/services/recoverysigner/internal/db/dbmigrate/dbmigrate_generated.go b/exp/services/recoverysigner/internal/db/dbmigrate/dbmigrate_generated.go index 0b5322861f..d3af13813e 100644 --- a/exp/services/recoverysigner/internal/db/dbmigrate/dbmigrate_generated.go +++ b/exp/services/recoverysigner/internal/db/dbmigrate/dbmigrate_generated.go @@ -380,15 +380,15 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "migrations": &bintree{nil, map[string]*bintree{ - "20200309000000-initial-1.sql": &bintree{migrations20200309000000Initial1Sql, map[string]*bintree{}}, - "20200309000001-initial-2.sql": &bintree{migrations20200309000001Initial2Sql, map[string]*bintree{}}, - "20200311000000-create-accounts.sql": &bintree{migrations20200311000000CreateAccountsSql, map[string]*bintree{}}, - "20200311000001-create-identities.sql": &bintree{migrations20200311000001CreateIdentitiesSql, map[string]*bintree{}}, - "20200311000002-create-auth-methods.sql": &bintree{migrations20200311000002CreateAuthMethodsSql, map[string]*bintree{}}, - "20200320000000-create-accounts-audit.sql": &bintree{migrations20200320000000CreateAccountsAuditSql, map[string]*bintree{}}, - "20200320000001-create-identities-audit.sql": &bintree{migrations20200320000001CreateIdentitiesAuditSql, map[string]*bintree{}}, - "20200320000002-create-auth-methods-audit.sql": &bintree{migrations20200320000002CreateAuthMethodsAuditSql, map[string]*bintree{}}, + "migrations": {nil, map[string]*bintree{ + "20200309000000-initial-1.sql": {migrations20200309000000Initial1Sql, map[string]*bintree{}}, + "20200309000001-initial-2.sql": {migrations20200309000001Initial2Sql, map[string]*bintree{}}, + "20200311000000-create-accounts.sql": {migrations20200311000000CreateAccountsSql, map[string]*bintree{}}, + "20200311000001-create-identities.sql": {migrations20200311000001CreateIdentitiesSql, map[string]*bintree{}}, + "20200311000002-create-auth-methods.sql": {migrations20200311000002CreateAuthMethodsSql, map[string]*bintree{}}, + "20200320000000-create-accounts-audit.sql": {migrations20200320000000CreateAccountsAuditSql, map[string]*bintree{}}, + "20200320000001-create-identities-audit.sql": {migrations20200320000001CreateIdentitiesAuditSql, map[string]*bintree{}}, + "20200320000002-create-auth-methods-audit.sql": {migrations20200320000002CreateAuthMethodsAuditSql, map[string]*bintree{}}, }}, }} diff --git a/gofmt.sh b/gofmt.sh index f51f2c931c..98b1791261 100755 --- a/gofmt.sh +++ b/gofmt.sh @@ -2,7 +2,7 @@ set -e printf "Running gofmt checks...\n" -OUTPUT=$(gofmt -d .) +OUTPUT=$(gofmt -d -s .) if [[ $OUTPUT ]]; then printf "gofmt found unformatted files:\n\n" diff --git a/gogenerate.sh b/gogenerate.sh index 307b87eecb..cb89037136 100755 --- a/gogenerate.sh +++ b/gogenerate.sh @@ -2,7 +2,7 @@ set -e printf "Running go generate...\n" -go generate ./... && go fmt ./... +go generate ./... && gofmt -s -w -d . printf "Checking for no diff...\n" git diff --exit-code || (echo "Files changed after running go generate. Run go generate ./... locally and update generated files." && exit 1) diff --git a/services/horizon/internal/db2/history/account_signers_test.go b/services/horizon/internal/db2/history/account_signers_test.go index 6e753515ae..158df82409 100644 --- a/services/horizon/internal/db2/history/account_signers_test.go +++ b/services/horizon/internal/db2/history/account_signers_test.go @@ -95,12 +95,12 @@ func TestMultipleAccountsForSigner(t *testing.T) { tt.Assert.Equal(int64(1), rowsAffected) expected := []AccountSigner{ - AccountSigner{ + { Account: account, Signer: signer, Weight: weight, }, - AccountSigner{ + { Account: anotherAccount, Signer: signer, Weight: anotherWeight, diff --git a/services/horizon/internal/db2/history/participants_test.go b/services/horizon/internal/db2/history/participants_test.go index ee37f2b833..4aaf70b151 100644 --- a/services/horizon/internal/db2/history/participants_test.go +++ b/services/horizon/internal/db2/history/participants_test.go @@ -48,10 +48,10 @@ func TestTransactionParticipantsBatch(t *testing.T) { participants := getTransactionParticipants(tt, q) tt.Assert.Equal( []transactionParticipant{ - transactionParticipant{TransactionID: 1, AccountID: 100}, - transactionParticipant{TransactionID: 1, AccountID: 101}, - transactionParticipant{TransactionID: 1, AccountID: 102}, - transactionParticipant{TransactionID: 2, AccountID: 100}, + {TransactionID: 1, AccountID: 100}, + {TransactionID: 1, AccountID: 101}, + {TransactionID: 1, AccountID: 102}, + {TransactionID: 2, AccountID: 100}, }, participants, ) diff --git a/services/horizon/internal/db2/schema/bindata.go b/services/horizon/internal/db2/schema/bindata.go index 1c68c940cc..a0d18c7b76 100644 --- a/services/horizon/internal/db2/schema/bindata.go +++ b/services/horizon/internal/db2/schema/bindata.go @@ -1612,71 +1612,71 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "migrations": &bintree{nil, map[string]*bintree{ - "10_add_trades_price.sql": &bintree{migrations10_add_trades_priceSql, map[string]*bintree{}}, - "11_add_trades_account_index.sql": &bintree{migrations11_add_trades_account_indexSql, map[string]*bintree{}}, - "12_asset_stats_amount_string.sql": &bintree{migrations12_asset_stats_amount_stringSql, map[string]*bintree{}}, - "13_trade_offer_ids.sql": &bintree{migrations13_trade_offer_idsSql, map[string]*bintree{}}, - "14_fix_asset_toml_field.sql": &bintree{migrations14_fix_asset_toml_fieldSql, map[string]*bintree{}}, - "15_ledger_failed_txs.sql": &bintree{migrations15_ledger_failed_txsSql, map[string]*bintree{}}, - "16_ingest_failed_transactions.sql": &bintree{migrations16_ingest_failed_transactionsSql, map[string]*bintree{}}, - "17_transaction_fee_paid.sql": &bintree{migrations17_transaction_fee_paidSql, map[string]*bintree{}}, - "18_account_for_signers.sql": &bintree{migrations18_account_for_signersSql, map[string]*bintree{}}, - "19_offers.sql": &bintree{migrations19_offersSql, map[string]*bintree{}}, - "1_initial_schema.sql": &bintree{migrations1_initial_schemaSql, map[string]*bintree{}}, - "20_account_for_signer_index.sql": &bintree{migrations20_account_for_signer_indexSql, map[string]*bintree{}}, - "21_trades_remove_zero_amount_constraints.sql": &bintree{migrations21_trades_remove_zero_amount_constraintsSql, map[string]*bintree{}}, - "22_trust_lines.sql": &bintree{migrations22_trust_linesSql, map[string]*bintree{}}, - "23_exp_asset_stats.sql": &bintree{migrations23_exp_asset_statsSql, map[string]*bintree{}}, - "24_accounts.sql": &bintree{migrations24_accountsSql, map[string]*bintree{}}, - "25_expingest_rename_columns.sql": &bintree{migrations25_expingest_rename_columnsSql, map[string]*bintree{}}, - "26_exp_history_ledgers.sql": &bintree{migrations26_exp_history_ledgersSql, map[string]*bintree{}}, - "27_exp_history_transactions.sql": &bintree{migrations27_exp_history_transactionsSql, map[string]*bintree{}}, - "28_exp_history_operations.sql": &bintree{migrations28_exp_history_operationsSql, map[string]*bintree{}}, - "29_exp_history_assets.sql": &bintree{migrations29_exp_history_assetsSql, map[string]*bintree{}}, - "2_index_participants_by_toid.sql": &bintree{migrations2_index_participants_by_toidSql, map[string]*bintree{}}, - "30_exp_history_trades.sql": &bintree{migrations30_exp_history_tradesSql, map[string]*bintree{}}, - "31_exp_history_effects.sql": &bintree{migrations31_exp_history_effectsSql, map[string]*bintree{}}, - "32_drop_exp_history_tables.sql": &bintree{migrations32_drop_exp_history_tablesSql, map[string]*bintree{}}, - "33_remove_unused.sql": &bintree{migrations33_remove_unusedSql, map[string]*bintree{}}, - "34_fee_bump_transactions.sql": &bintree{migrations34_fee_bump_transactionsSql, map[string]*bintree{}}, - "35_drop_participant_id.sql": &bintree{migrations35_drop_participant_idSql, map[string]*bintree{}}, - "36_deleted_offers.sql": &bintree{migrations36_deleted_offersSql, map[string]*bintree{}}, - "37_add_tx_set_operation_count_to_ledgers.sql": &bintree{migrations37_add_tx_set_operation_count_to_ledgersSql, map[string]*bintree{}}, - "38_add_constraints.sql": &bintree{migrations38_add_constraintsSql, map[string]*bintree{}}, - "39_claimable_balances.sql": &bintree{migrations39_claimable_balancesSql, map[string]*bintree{}}, - "39_history_trades_indices.sql": &bintree{migrations39_history_trades_indicesSql, map[string]*bintree{}}, - "3_use_sequence_in_history_accounts.sql": &bintree{migrations3_use_sequence_in_history_accountsSql, map[string]*bintree{}}, - "40_fix_inner_tx_max_fee_constraint.sql": &bintree{migrations40_fix_inner_tx_max_fee_constraintSql, map[string]*bintree{}}, - "41_add_sponsor_to_state_tables.sql": &bintree{migrations41_add_sponsor_to_state_tablesSql, map[string]*bintree{}}, - "42_add_num_sponsored_and_num_sponsoring_to_accounts.sql": &bintree{migrations42_add_num_sponsored_and_num_sponsoring_to_accountsSql, map[string]*bintree{}}, - "43_add_claimable_balances_flags.sql": &bintree{migrations43_add_claimable_balances_flagsSql, map[string]*bintree{}}, - "44_asset_stat_accounts_and_balances.sql": &bintree{migrations44_asset_stat_accounts_and_balancesSql, map[string]*bintree{}}, - "45_add_claimable_balances_history.sql": &bintree{migrations45_add_claimable_balances_historySql, map[string]*bintree{}}, - "46_add_muxed_accounts.sql": &bintree{migrations46_add_muxed_accountsSql, map[string]*bintree{}}, - "47_precompute_trade_aggregations.sql": &bintree{migrations47_precompute_trade_aggregationsSql, map[string]*bintree{}}, - "48_rebuild_trade_aggregations.sql": &bintree{migrations48_rebuild_trade_aggregationsSql, map[string]*bintree{}}, - "49_add_brin_index_trade_aggregations.sql": &bintree{migrations49_add_brin_index_trade_aggregationsSql, map[string]*bintree{}}, - "4_add_protocol_version.sql": &bintree{migrations4_add_protocol_versionSql, map[string]*bintree{}}, - "50_liquidity_pools.sql": &bintree{migrations50_liquidity_poolsSql, map[string]*bintree{}}, - "51_remove_ht_unused_indexes.sql": &bintree{migrations51_remove_ht_unused_indexesSql, map[string]*bintree{}}, - "52_add_trade_type_index.sql": &bintree{migrations52_add_trade_type_indexSql, map[string]*bintree{}}, - "53_add_trades_rounding_slippage.sql": &bintree{migrations53_add_trades_rounding_slippageSql, map[string]*bintree{}}, - "54_tx_preconditions_and_account_fields.sql": &bintree{migrations54_tx_preconditions_and_account_fieldsSql, map[string]*bintree{}}, - "55_filter_rules.sql": &bintree{migrations55_filter_rulesSql, map[string]*bintree{}}, - "56_txsub_read_only.sql": &bintree{migrations56_txsub_read_onlySql, map[string]*bintree{}}, - "57_trade_aggregation_autovac.sql": &bintree{migrations57_trade_aggregation_autovacSql, map[string]*bintree{}}, - "58_add_index_by_id_optimization.sql": &bintree{migrations58_add_index_by_id_optimizationSql, map[string]*bintree{}}, - "59_remove_foreign_key_constraints.sql": &bintree{migrations59_remove_foreign_key_constraintsSql, map[string]*bintree{}}, - "5_create_trades_table.sql": &bintree{migrations5_create_trades_tableSql, map[string]*bintree{}}, - "60_add_asset_id_indexes.sql": &bintree{migrations60_add_asset_id_indexesSql, map[string]*bintree{}}, - "61_trust_lines_by_account_type_code_issuer.sql": &bintree{migrations61_trust_lines_by_account_type_code_issuerSql, map[string]*bintree{}}, - "62_claimable_balance_claimants.sql": &bintree{migrations62_claimable_balance_claimantsSql, map[string]*bintree{}}, - "6_create_assets_table.sql": &bintree{migrations6_create_assets_tableSql, map[string]*bintree{}}, - "7_modify_trades_table.sql": &bintree{migrations7_modify_trades_tableSql, map[string]*bintree{}}, - "8_add_aggregators.sql": &bintree{migrations8_add_aggregatorsSql, map[string]*bintree{}}, - "8_create_asset_stats_table.sql": &bintree{migrations8_create_asset_stats_tableSql, map[string]*bintree{}}, - "9_add_header_xdr.sql": &bintree{migrations9_add_header_xdrSql, map[string]*bintree{}}, + "migrations": {nil, map[string]*bintree{ + "10_add_trades_price.sql": {migrations10_add_trades_priceSql, map[string]*bintree{}}, + "11_add_trades_account_index.sql": {migrations11_add_trades_account_indexSql, map[string]*bintree{}}, + "12_asset_stats_amount_string.sql": {migrations12_asset_stats_amount_stringSql, map[string]*bintree{}}, + "13_trade_offer_ids.sql": {migrations13_trade_offer_idsSql, map[string]*bintree{}}, + "14_fix_asset_toml_field.sql": {migrations14_fix_asset_toml_fieldSql, map[string]*bintree{}}, + "15_ledger_failed_txs.sql": {migrations15_ledger_failed_txsSql, map[string]*bintree{}}, + "16_ingest_failed_transactions.sql": {migrations16_ingest_failed_transactionsSql, map[string]*bintree{}}, + "17_transaction_fee_paid.sql": {migrations17_transaction_fee_paidSql, map[string]*bintree{}}, + "18_account_for_signers.sql": {migrations18_account_for_signersSql, map[string]*bintree{}}, + "19_offers.sql": {migrations19_offersSql, map[string]*bintree{}}, + "1_initial_schema.sql": {migrations1_initial_schemaSql, map[string]*bintree{}}, + "20_account_for_signer_index.sql": {migrations20_account_for_signer_indexSql, map[string]*bintree{}}, + "21_trades_remove_zero_amount_constraints.sql": {migrations21_trades_remove_zero_amount_constraintsSql, map[string]*bintree{}}, + "22_trust_lines.sql": {migrations22_trust_linesSql, map[string]*bintree{}}, + "23_exp_asset_stats.sql": {migrations23_exp_asset_statsSql, map[string]*bintree{}}, + "24_accounts.sql": {migrations24_accountsSql, map[string]*bintree{}}, + "25_expingest_rename_columns.sql": {migrations25_expingest_rename_columnsSql, map[string]*bintree{}}, + "26_exp_history_ledgers.sql": {migrations26_exp_history_ledgersSql, map[string]*bintree{}}, + "27_exp_history_transactions.sql": {migrations27_exp_history_transactionsSql, map[string]*bintree{}}, + "28_exp_history_operations.sql": {migrations28_exp_history_operationsSql, map[string]*bintree{}}, + "29_exp_history_assets.sql": {migrations29_exp_history_assetsSql, map[string]*bintree{}}, + "2_index_participants_by_toid.sql": {migrations2_index_participants_by_toidSql, map[string]*bintree{}}, + "30_exp_history_trades.sql": {migrations30_exp_history_tradesSql, map[string]*bintree{}}, + "31_exp_history_effects.sql": {migrations31_exp_history_effectsSql, map[string]*bintree{}}, + "32_drop_exp_history_tables.sql": {migrations32_drop_exp_history_tablesSql, map[string]*bintree{}}, + "33_remove_unused.sql": {migrations33_remove_unusedSql, map[string]*bintree{}}, + "34_fee_bump_transactions.sql": {migrations34_fee_bump_transactionsSql, map[string]*bintree{}}, + "35_drop_participant_id.sql": {migrations35_drop_participant_idSql, map[string]*bintree{}}, + "36_deleted_offers.sql": {migrations36_deleted_offersSql, map[string]*bintree{}}, + "37_add_tx_set_operation_count_to_ledgers.sql": {migrations37_add_tx_set_operation_count_to_ledgersSql, map[string]*bintree{}}, + "38_add_constraints.sql": {migrations38_add_constraintsSql, map[string]*bintree{}}, + "39_claimable_balances.sql": {migrations39_claimable_balancesSql, map[string]*bintree{}}, + "39_history_trades_indices.sql": {migrations39_history_trades_indicesSql, map[string]*bintree{}}, + "3_use_sequence_in_history_accounts.sql": {migrations3_use_sequence_in_history_accountsSql, map[string]*bintree{}}, + "40_fix_inner_tx_max_fee_constraint.sql": {migrations40_fix_inner_tx_max_fee_constraintSql, map[string]*bintree{}}, + "41_add_sponsor_to_state_tables.sql": {migrations41_add_sponsor_to_state_tablesSql, map[string]*bintree{}}, + "42_add_num_sponsored_and_num_sponsoring_to_accounts.sql": {migrations42_add_num_sponsored_and_num_sponsoring_to_accountsSql, map[string]*bintree{}}, + "43_add_claimable_balances_flags.sql": {migrations43_add_claimable_balances_flagsSql, map[string]*bintree{}}, + "44_asset_stat_accounts_and_balances.sql": {migrations44_asset_stat_accounts_and_balancesSql, map[string]*bintree{}}, + "45_add_claimable_balances_history.sql": {migrations45_add_claimable_balances_historySql, map[string]*bintree{}}, + "46_add_muxed_accounts.sql": {migrations46_add_muxed_accountsSql, map[string]*bintree{}}, + "47_precompute_trade_aggregations.sql": {migrations47_precompute_trade_aggregationsSql, map[string]*bintree{}}, + "48_rebuild_trade_aggregations.sql": {migrations48_rebuild_trade_aggregationsSql, map[string]*bintree{}}, + "49_add_brin_index_trade_aggregations.sql": {migrations49_add_brin_index_trade_aggregationsSql, map[string]*bintree{}}, + "4_add_protocol_version.sql": {migrations4_add_protocol_versionSql, map[string]*bintree{}}, + "50_liquidity_pools.sql": {migrations50_liquidity_poolsSql, map[string]*bintree{}}, + "51_remove_ht_unused_indexes.sql": {migrations51_remove_ht_unused_indexesSql, map[string]*bintree{}}, + "52_add_trade_type_index.sql": {migrations52_add_trade_type_indexSql, map[string]*bintree{}}, + "53_add_trades_rounding_slippage.sql": {migrations53_add_trades_rounding_slippageSql, map[string]*bintree{}}, + "54_tx_preconditions_and_account_fields.sql": {migrations54_tx_preconditions_and_account_fieldsSql, map[string]*bintree{}}, + "55_filter_rules.sql": {migrations55_filter_rulesSql, map[string]*bintree{}}, + "56_txsub_read_only.sql": {migrations56_txsub_read_onlySql, map[string]*bintree{}}, + "57_trade_aggregation_autovac.sql": {migrations57_trade_aggregation_autovacSql, map[string]*bintree{}}, + "58_add_index_by_id_optimization.sql": {migrations58_add_index_by_id_optimizationSql, map[string]*bintree{}}, + "59_remove_foreign_key_constraints.sql": {migrations59_remove_foreign_key_constraintsSql, map[string]*bintree{}}, + "5_create_trades_table.sql": {migrations5_create_trades_tableSql, map[string]*bintree{}}, + "60_add_asset_id_indexes.sql": {migrations60_add_asset_id_indexesSql, map[string]*bintree{}}, + "61_trust_lines_by_account_type_code_issuer.sql": {migrations61_trust_lines_by_account_type_code_issuerSql, map[string]*bintree{}}, + "62_claimable_balance_claimants.sql": {migrations62_claimable_balance_claimantsSql, map[string]*bintree{}}, + "6_create_assets_table.sql": {migrations6_create_assets_tableSql, map[string]*bintree{}}, + "7_modify_trades_table.sql": {migrations7_modify_trades_tableSql, map[string]*bintree{}}, + "8_add_aggregators.sql": {migrations8_add_aggregatorsSql, map[string]*bintree{}}, + "8_create_asset_stats_table.sql": {migrations8_create_asset_stats_tableSql, map[string]*bintree{}}, + "9_add_header_xdr.sql": {migrations9_add_header_xdrSql, map[string]*bintree{}}, }}, }} diff --git a/services/horizon/internal/test/scenarios/bindata.go b/services/horizon/internal/test/scenarios/bindata.go index ad319285e8..5ed13e86cb 100644 --- a/services/horizon/internal/test/scenarios/bindata.go +++ b/services/horizon/internal/test/scenarios/bindata.go @@ -688,28 +688,28 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "account_merge-core.sql": &bintree{account_mergeCoreSql, map[string]*bintree{}}, - "account_merge-horizon.sql": &bintree{account_mergeHorizonSql, map[string]*bintree{}}, - "base-core.sql": &bintree{baseCoreSql, map[string]*bintree{}}, - "base-horizon.sql": &bintree{baseHorizonSql, map[string]*bintree{}}, - "failed_transactions-core.sql": &bintree{failed_transactionsCoreSql, map[string]*bintree{}}, - "failed_transactions-horizon.sql": &bintree{failed_transactionsHorizonSql, map[string]*bintree{}}, - "ingest_asset_stats-core.sql": &bintree{ingest_asset_statsCoreSql, map[string]*bintree{}}, - "ingest_asset_stats-horizon.sql": &bintree{ingest_asset_statsHorizonSql, map[string]*bintree{}}, - "kahuna-core.sql": &bintree{kahunaCoreSql, map[string]*bintree{}}, - "kahuna-horizon.sql": &bintree{kahunaHorizonSql, map[string]*bintree{}}, - "offer_ids-core.sql": &bintree{offer_idsCoreSql, map[string]*bintree{}}, - "offer_ids-horizon.sql": &bintree{offer_idsHorizonSql, map[string]*bintree{}}, - "operation_fee_stats_1-core.sql": &bintree{operation_fee_stats_1CoreSql, map[string]*bintree{}}, - "operation_fee_stats_1-horizon.sql": &bintree{operation_fee_stats_1HorizonSql, map[string]*bintree{}}, - "operation_fee_stats_2-core.sql": &bintree{operation_fee_stats_2CoreSql, map[string]*bintree{}}, - "operation_fee_stats_2-horizon.sql": &bintree{operation_fee_stats_2HorizonSql, map[string]*bintree{}}, - "operation_fee_stats_3-core.sql": &bintree{operation_fee_stats_3CoreSql, map[string]*bintree{}}, - "operation_fee_stats_3-horizon.sql": &bintree{operation_fee_stats_3HorizonSql, map[string]*bintree{}}, - "pathed_payment-core.sql": &bintree{pathed_paymentCoreSql, map[string]*bintree{}}, - "pathed_payment-horizon.sql": &bintree{pathed_paymentHorizonSql, map[string]*bintree{}}, - "paths_strict_send-core.sql": &bintree{paths_strict_sendCoreSql, map[string]*bintree{}}, - "paths_strict_send-horizon.sql": &bintree{paths_strict_sendHorizonSql, map[string]*bintree{}}, + "account_merge-core.sql": {account_mergeCoreSql, map[string]*bintree{}}, + "account_merge-horizon.sql": {account_mergeHorizonSql, map[string]*bintree{}}, + "base-core.sql": {baseCoreSql, map[string]*bintree{}}, + "base-horizon.sql": {baseHorizonSql, map[string]*bintree{}}, + "failed_transactions-core.sql": {failed_transactionsCoreSql, map[string]*bintree{}}, + "failed_transactions-horizon.sql": {failed_transactionsHorizonSql, map[string]*bintree{}}, + "ingest_asset_stats-core.sql": {ingest_asset_statsCoreSql, map[string]*bintree{}}, + "ingest_asset_stats-horizon.sql": {ingest_asset_statsHorizonSql, map[string]*bintree{}}, + "kahuna-core.sql": {kahunaCoreSql, map[string]*bintree{}}, + "kahuna-horizon.sql": {kahunaHorizonSql, map[string]*bintree{}}, + "offer_ids-core.sql": {offer_idsCoreSql, map[string]*bintree{}}, + "offer_ids-horizon.sql": {offer_idsHorizonSql, map[string]*bintree{}}, + "operation_fee_stats_1-core.sql": {operation_fee_stats_1CoreSql, map[string]*bintree{}}, + "operation_fee_stats_1-horizon.sql": {operation_fee_stats_1HorizonSql, map[string]*bintree{}}, + "operation_fee_stats_2-core.sql": {operation_fee_stats_2CoreSql, map[string]*bintree{}}, + "operation_fee_stats_2-horizon.sql": {operation_fee_stats_2HorizonSql, map[string]*bintree{}}, + "operation_fee_stats_3-core.sql": {operation_fee_stats_3CoreSql, map[string]*bintree{}}, + "operation_fee_stats_3-horizon.sql": {operation_fee_stats_3HorizonSql, map[string]*bintree{}}, + "pathed_payment-core.sql": {pathed_paymentCoreSql, map[string]*bintree{}}, + "pathed_payment-horizon.sql": {pathed_paymentHorizonSql, map[string]*bintree{}}, + "paths_strict_send-core.sql": {paths_strict_sendCoreSql, map[string]*bintree{}}, + "paths_strict_send-horizon.sql": {paths_strict_sendHorizonSql, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/services/keystore/api.go b/services/keystore/api.go index f4915f6334..bdce9513cc 100644 --- a/services/keystore/api.go +++ b/services/keystore/api.go @@ -65,8 +65,8 @@ type authResponse struct { } var forwardHeaders = map[string]struct{}{ - "authorization": struct{}{}, - "cookie": struct{}{}, + "authorization": {}, + "cookie": {}, } func authHandler(next http.Handler, authenticator *Authenticator) http.Handler { diff --git a/services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_generated.go b/services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_generated.go index 39efd3c0a8..4b82c3ddd0 100644 --- a/services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_generated.go +++ b/services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_generated.go @@ -270,10 +270,10 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "migrations": &bintree{nil, map[string]*bintree{ - "2021-05-05.0.initial.sql": &bintree{migrations202105050InitialSql, map[string]*bintree{}}, - "2021-05-18.0.accounts-kyc-status.sql": &bintree{migrations202105180AccountsKycStatusSql, map[string]*bintree{}}, - "2021-06-08.0.pending-kyc-status.sql": &bintree{migrations202106080PendingKycStatusSql, map[string]*bintree{}}, + "migrations": {nil, map[string]*bintree{ + "2021-05-05.0.initial.sql": {migrations202105050InitialSql, map[string]*bintree{}}, + "2021-05-18.0.accounts-kyc-status.sql": {migrations202105180AccountsKycStatusSql, map[string]*bintree{}}, + "2021-06-08.0.pending-kyc-status.sql": {migrations202106080PendingKycStatusSql, map[string]*bintree{}}, }}, }} diff --git a/services/ticker/internal/gql/static/bindata.go b/services/ticker/internal/gql/static/bindata.go index 298e85a5d3..31c22760ed 100644 --- a/services/ticker/internal/gql/static/bindata.go +++ b/services/ticker/internal/gql/static/bindata.go @@ -248,8 +248,8 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "graphiql.html": &bintree{graphiqlHtml, map[string]*bintree{}}, - "schema.gql": &bintree{schemaGql, map[string]*bintree{}}, + "graphiql.html": {graphiqlHtml, map[string]*bintree{}}, + "schema.gql": {schemaGql, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/services/ticker/internal/tickerdb/helpers_test.go b/services/ticker/internal/tickerdb/helpers_test.go index 6c09306636..71f025aa20 100644 --- a/services/ticker/internal/tickerdb/helpers_test.go +++ b/services/ticker/internal/tickerdb/helpers_test.go @@ -70,20 +70,20 @@ func TestGenerateWhereClause(t *testing.T) { *baseAssetIssuer = "baseAssetIssuer" where1, args1 := generateWhereClause([]optionalVar{ - optionalVar{"t1.base_asset_code", nil}, - optionalVar{"t1.base_asset_issuer", nil}, - optionalVar{"t1.counter_asset_code", nil}, - optionalVar{"t1.counter_asset_issuer", nil}, + {"t1.base_asset_code", nil}, + {"t1.base_asset_issuer", nil}, + {"t1.counter_asset_code", nil}, + {"t1.counter_asset_issuer", nil}, }) assert.Equal(t, "", where1) assert.Equal(t, 0, len(args1)) where2, args2 := generateWhereClause([]optionalVar{ - optionalVar{"t1.base_asset_code", baseAssetCode}, - optionalVar{"t1.base_asset_issuer", nil}, - optionalVar{"t1.counter_asset_code", nil}, - optionalVar{"t1.counter_asset_issuer", nil}, + {"t1.base_asset_code", baseAssetCode}, + {"t1.base_asset_issuer", nil}, + {"t1.counter_asset_code", nil}, + {"t1.counter_asset_issuer", nil}, }) assert.Equal(t, "WHERE t1.base_asset_code = ?", where2) @@ -91,10 +91,10 @@ func TestGenerateWhereClause(t *testing.T) { assert.Equal(t, *baseAssetCode, args2[0]) where3, args3 := generateWhereClause([]optionalVar{ - optionalVar{"t1.base_asset_code", baseAssetCode}, - optionalVar{"t1.base_asset_issuer", baseAssetIssuer}, - optionalVar{"t1.counter_asset_code", nil}, - optionalVar{"t1.counter_asset_issuer", nil}, + {"t1.base_asset_code", baseAssetCode}, + {"t1.base_asset_issuer", baseAssetIssuer}, + {"t1.counter_asset_code", nil}, + {"t1.counter_asset_issuer", nil}, }) assert.Equal(t, "WHERE t1.base_asset_code = ? AND t1.base_asset_issuer = ?", where3) diff --git a/services/ticker/internal/tickerdb/migrations/bindata.go b/services/ticker/internal/tickerdb/migrations/bindata.go index c91398d945..c335b6ff5a 100644 --- a/services/ticker/internal/tickerdb/migrations/bindata.go +++ b/services/ticker/internal/tickerdb/migrations/bindata.go @@ -446,18 +446,18 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "migrations": &bintree{nil, map[string]*bintree{ - "20190404184050-initial.sql": &bintree{migrations20190404184050InitialSql, map[string]*bintree{}}, - "20190405112544-increase_asset_code_size.sql": &bintree{migrations20190405112544Increase_asset_code_sizeSql, map[string]*bintree{}}, - "20190408115724-add_new_asset_fields.sql": &bintree{migrations20190408115724Add_new_asset_fieldsSql, map[string]*bintree{}}, - "20190408155841-add_issuers_table.sql": &bintree{migrations20190408155841Add_issuers_tableSql, map[string]*bintree{}}, - "20190409152216-add_trades_table.sql": &bintree{migrations20190409152216Add_trades_tableSql, map[string]*bintree{}}, - "20190409172610-rename_assets_desc_description.sql": &bintree{migrations20190409172610Rename_assets_desc_descriptionSql, map[string]*bintree{}}, - "20190410094830-add_assets_issuer_account_field.sql": &bintree{migrations20190410094830Add_assets_issuer_account_fieldSql, map[string]*bintree{}}, - "20190411165735-data_seed_and_indices.sql": &bintree{migrations20190411165735Data_seed_and_indicesSql, map[string]*bintree{}}, - "20190425110313-add_orderbook_stats.sql": &bintree{migrations20190425110313Add_orderbook_statsSql, map[string]*bintree{}}, - "20190426092321-add_aggregated_orderbook_view.sql": &bintree{migrations20190426092321Add_aggregated_orderbook_viewSql, map[string]*bintree{}}, - "20220909100700-trades_pk_to_bigint.sql": &bintree{migrations20220909100700Trades_pk_to_bigintSql, map[string]*bintree{}}, + "migrations": {nil, map[string]*bintree{ + "20190404184050-initial.sql": {migrations20190404184050InitialSql, map[string]*bintree{}}, + "20190405112544-increase_asset_code_size.sql": {migrations20190405112544Increase_asset_code_sizeSql, map[string]*bintree{}}, + "20190408115724-add_new_asset_fields.sql": {migrations20190408115724Add_new_asset_fieldsSql, map[string]*bintree{}}, + "20190408155841-add_issuers_table.sql": {migrations20190408155841Add_issuers_tableSql, map[string]*bintree{}}, + "20190409152216-add_trades_table.sql": {migrations20190409152216Add_trades_tableSql, map[string]*bintree{}}, + "20190409172610-rename_assets_desc_description.sql": {migrations20190409172610Rename_assets_desc_descriptionSql, map[string]*bintree{}}, + "20190410094830-add_assets_issuer_account_field.sql": {migrations20190410094830Add_assets_issuer_account_fieldSql, map[string]*bintree{}}, + "20190411165735-data_seed_and_indices.sql": {migrations20190411165735Data_seed_and_indicesSql, map[string]*bintree{}}, + "20190425110313-add_orderbook_stats.sql": {migrations20190425110313Add_orderbook_statsSql, map[string]*bintree{}}, + "20190426092321-add_aggregated_orderbook_view.sql": {migrations20190426092321Add_aggregated_orderbook_viewSql, map[string]*bintree{}}, + "20220909100700-trades_pk_to_bigint.sql": {migrations20220909100700Trades_pk_to_bigintSql, map[string]*bintree{}}, }}, }} diff --git a/services/ticker/internal/tickerdb/queries_market.go b/services/ticker/internal/tickerdb/queries_market.go index 8984fcb3eb..d0121cdeac 100644 --- a/services/ticker/internal/tickerdb/queries_market.go +++ b/services/ticker/internal/tickerdb/queries_market.go @@ -23,8 +23,8 @@ func (s *TickerSession) RetrievePartialAggMarkets(ctx context.Context, sqlTrue := new(string) *sqlTrue = "TRUE" optVars := []optionalVar{ - optionalVar{"bAsset.is_valid", sqlTrue}, - optionalVar{"cAsset.is_valid", sqlTrue}, + {"bAsset.is_valid", sqlTrue}, + {"cAsset.is_valid", sqlTrue}, } // parse base and asset codes and add them as SQL parameters @@ -34,8 +34,8 @@ func (s *TickerSession) RetrievePartialAggMarkets(ctx context.Context, return } optVars = append(optVars, []optionalVar{ - optionalVar{"bAsset.code", &bCode}, - optionalVar{"cAsset.code", &cCode}, + {"bAsset.code", &bCode}, + {"cAsset.code", &cCode}, }...) } @@ -70,12 +70,12 @@ func (s *TickerSession) RetrievePartialMarkets(ctx context.Context, *sqlTrue = "TRUE" where, args := generateWhereClause([]optionalVar{ - optionalVar{"bAsset.is_valid", sqlTrue}, - optionalVar{"cAsset.is_valid", sqlTrue}, - optionalVar{"bAsset.code", baseAssetCode}, - optionalVar{"bAsset.issuer_account", baseAssetIssuer}, - optionalVar{"cAsset.code", counterAssetCode}, - optionalVar{"cAsset.issuer_account", counterAssetIssuer}, + {"bAsset.is_valid", sqlTrue}, + {"cAsset.is_valid", sqlTrue}, + {"bAsset.code", baseAssetCode}, + {"bAsset.issuer_account", baseAssetIssuer}, + {"cAsset.code", counterAssetCode}, + {"cAsset.issuer_account", counterAssetIssuer}, }) where += fmt.Sprintf( " AND t.ledger_close_time > now() - interval '%d hours'", diff --git a/services/ticker/internal/tickerdb/queries_market_test.go b/services/ticker/internal/tickerdb/queries_market_test.go index f6be900390..727a659dd7 100644 --- a/services/ticker/internal/tickerdb/queries_market_test.go +++ b/services/ticker/internal/tickerdb/queries_market_test.go @@ -106,7 +106,7 @@ func TestRetrieveMarketData(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ // XLM_BTC trade + { // XLM_BTC trade HorizonID: "hrzid1", BaseAssetID: xlmAsset.ID, BaseAmount: 100.0, @@ -115,7 +115,7 @@ func TestRetrieveMarketData(t *testing.T) { Price: 0.1, LedgerCloseTime: now, }, - Trade{ // XLM_ETH trade + { // XLM_ETH trade HorizonID: "hrzid3", BaseAssetID: xlmAsset.ID, BaseAmount: 24.0, @@ -124,7 +124,7 @@ func TestRetrieveMarketData(t *testing.T) { Price: 0.92, LedgerCloseTime: oneHourAgo, }, - Trade{ // XLM_ETH trade + { // XLM_ETH trade HorizonID: "hrzid2", BaseAssetID: xlmAsset.ID, BaseAmount: 50.0, @@ -133,7 +133,7 @@ func TestRetrieveMarketData(t *testing.T) { Price: 1.0, LedgerCloseTime: now, }, - Trade{ // XLM_BTC trade + { // XLM_BTC trade HorizonID: "hrzid4", BaseAssetID: xlmAsset.ID, BaseAmount: 50.0, @@ -142,7 +142,7 @@ func TestRetrieveMarketData(t *testing.T) { Price: 0.12, LedgerCloseTime: threeDaysAgo, }, - Trade{ // XLM_ETH trade + { // XLM_ETH trade HorizonID: "hrzid5", BaseAssetID: xlmAsset.ID, BaseAmount: 24.0, @@ -416,7 +416,7 @@ func TestRetrievePartialMarkets(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid1", BaseAssetID: btcAsset.ID, BaseAmount: 100.0, @@ -425,7 +425,7 @@ func TestRetrievePartialMarkets(t *testing.T) { Price: 0.1, LedgerCloseTime: tenMinutesAgo, }, - Trade{ // BTC_ETH trade (ETH is from issuer 2) + { // BTC_ETH trade (ETH is from issuer 2) HorizonID: "hrzid3", BaseAssetID: btcAsset.ID, BaseAmount: 24.0, @@ -434,7 +434,7 @@ func TestRetrievePartialMarkets(t *testing.T) { Price: 0.92, LedgerCloseTime: now, }, - Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid2", BaseAssetID: btcAsset.ID, BaseAmount: 50.0, @@ -443,7 +443,7 @@ func TestRetrievePartialMarkets(t *testing.T) { Price: 1.0, LedgerCloseTime: oneHourAgo, }, - Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid4", BaseAssetID: btcAsset.ID, BaseAmount: 50.0, @@ -688,7 +688,7 @@ func Test24hStatsFallback(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ + { HorizonID: "hrzid1", BaseAssetID: xlmAsset.ID, BaseAmount: 1.0, @@ -697,7 +697,7 @@ func Test24hStatsFallback(t *testing.T) { Price: 0.5, // close price & lowest price LedgerCloseTime: twoDaysAgo, }, - Trade{ // BTC_ETH trade (ETH is from issuer 2) + { // BTC_ETH trade (ETH is from issuer 2) HorizonID: "hrzid2", BaseAssetID: xlmAsset.ID, BaseAmount: 1.0, @@ -795,7 +795,7 @@ func TestPreferAnchorAssetCode(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ + { HorizonID: "hrzid1", BaseAssetID: xlmAsset.ID, BaseAmount: 1.0, @@ -804,7 +804,7 @@ func TestPreferAnchorAssetCode(t *testing.T) { Price: 0.5, // close price & lowest price LedgerCloseTime: twoDaysAgo, }, - Trade{ // BTC_ETH trade (ETH is from issuer 2) + { // BTC_ETH trade (ETH is from issuer 2) HorizonID: "hrzid2", BaseAssetID: xlmAsset.ID, BaseAmount: 1.0, diff --git a/services/ticker/internal/tickerdb/queries_trade_test.go b/services/ticker/internal/tickerdb/queries_trade_test.go index 3793eaa7a4..c24717261b 100644 --- a/services/ticker/internal/tickerdb/queries_trade_test.go +++ b/services/ticker/internal/tickerdb/queries_trade_test.go @@ -80,13 +80,13 @@ func TestBulkInsertTrades(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ + { HorizonID: "hrzid1", BaseAssetID: asset1.ID, CounterAssetID: asset2.ID, LedgerCloseTime: time.Now(), }, - Trade{ + { HorizonID: "hrzid2", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, @@ -193,19 +193,19 @@ func TestGetLastTrade(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ + { HorizonID: "hrzid2", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, LedgerCloseTime: oneYearBefore, }, - Trade{ + { HorizonID: "hrzid1", BaseAssetID: asset1.ID, CounterAssetID: asset2.ID, LedgerCloseTime: now, }, - Trade{ + { HorizonID: "hrzid2", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, @@ -296,25 +296,25 @@ func TestDeleteOldTrades(t *testing.T) { // Now let's create the trades: trades := []Trade{ - Trade{ + { HorizonID: "hrzid1", BaseAssetID: asset1.ID, CounterAssetID: asset2.ID, LedgerCloseTime: now, }, - Trade{ + { HorizonID: "hrzid2", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, LedgerCloseTime: oneDayAgo, }, - Trade{ + { HorizonID: "hrzid3", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, LedgerCloseTime: oneMonthAgo, }, - Trade{ + { HorizonID: "hrzid4", BaseAssetID: asset2.ID, CounterAssetID: asset1.ID, diff --git a/services/ticker/internal/tickerdb/tickerdbtest/tickerdbtest.go b/services/ticker/internal/tickerdb/tickerdbtest/tickerdbtest.go index 61de9037fc..0160b409f8 100644 --- a/services/ticker/internal/tickerdb/tickerdbtest/tickerdbtest.go +++ b/services/ticker/internal/tickerdb/tickerdbtest/tickerdbtest.go @@ -128,7 +128,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd // Now let's create the trades: trades := []tickerdb.Trade{ - tickerdb.Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid1", BaseAssetID: btcAsset.ID, BaseAmount: 100.0, @@ -137,7 +137,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd Price: 0.1, LedgerCloseTime: tenMinutesAgo, }, - tickerdb.Trade{ // BTC_ETH trade (ETH is from issuer 2) + { // BTC_ETH trade (ETH is from issuer 2) HorizonID: "hrzid3", BaseAssetID: btcAsset.ID, BaseAmount: 24.0, @@ -146,7 +146,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd Price: 0.92, LedgerCloseTime: now, }, - tickerdb.Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid2", BaseAssetID: btcAsset.ID, BaseAmount: 50.0, @@ -155,7 +155,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd Price: 1.0, LedgerCloseTime: oneHourAgo, }, - tickerdb.Trade{ // BTC_ETH trade (ETH is from issuer 1) + { // BTC_ETH trade (ETH is from issuer 1) HorizonID: "hrzid4", BaseAssetID: btcAsset.ID, BaseAmount: 50.0, @@ -303,7 +303,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd // Add XLM/BTC trades. trades = []tickerdb.Trade{ - tickerdb.Trade{ + { HorizonID: "hrzid5", BaseAssetID: xlmAsset.ID, BaseAmount: 10.0, @@ -312,7 +312,7 @@ func SetupTickerTestSession(t *testing.T, migrationsDir string) (session tickerd Price: 0.5, // close price & lowest price LedgerCloseTime: tenMinutesAgo, }, - tickerdb.Trade{ + { HorizonID: "hrzid6", BaseAssetID: xlmAsset.ID, BaseAmount: 10.0,