Skip to content

Commit

Permalink
Revert "all: enforce simplified Golang code (#4852) (#4853)"
Browse files Browse the repository at this point in the history
This reverts commit 768b7a1.
  • Loading branch information
2opremio authored Apr 20, 2023
1 parent 768b7a1 commit 0224737
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 194 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ regulated-assets-approval-server:

gxdr/xdr_generated.go: $(XDRS)
go run github.com/xdrpp/goxdr/cmd/goxdr -p gxdr -enum-comments -o $@ $(XDRS)
gofmt -s -w $@
go fmt $@

xdr/%.x:
printf "%s" ${XDRNEXT_COMMIT} > xdr/xdr_commit_generated.txt
Expand All @@ -52,7 +52,7 @@ xdr/xdr_generated.go: $(XDRS)
--namespace xdr \
--output xdr/ \
$(XDRS)'
gofmt -s -w $@
go fmt $@

xdr: gxdr/xdr_generated.go xdr/xdr_generated.go

Expand Down
2 changes: 1 addition & 1 deletion exp/orderbook/graph_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion exp/orderbook/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
26 changes: 13 additions & 13 deletions exp/services/market-tracker/calc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -134,35 +134,35 @@ 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.,
},
}

asks := []usdOrder{
{
usdOrder{
xlmAmount: 5.,
usdAmount: 100.,
usdPrice: 20.,
},
{
usdOrder{
xlmAmount: 4.,
usdAmount: 100.,
usdPrice: 25.,
},
{
usdOrder{
xlmAmount: 4.,
usdAmount: 120.,
usdPrice: 30.,
Expand Down Expand Up @@ -209,35 +209,35 @@ 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.,
},
}

asks := []usdOrder{
{
usdOrder{
xlmAmount: 5.,
usdAmount: 100.,
usdPrice: 20.,
},
{
usdOrder{
xlmAmount: 4.,
usdAmount: 100.,
usdPrice: 25.,
},
{
usdOrder{
xlmAmount: 4.,
usdAmount: 120.,
usdPrice: 30.,
Expand Down
2 changes: 1 addition & 1 deletion exp/services/market-tracker/orders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
)

var badAmtOrders = []hProtocol.PriceLevel{{
var badAmtOrders = []hProtocol.PriceLevel{hProtocol.PriceLevel{
PriceR: hProtocol.Price{
N: 4,
D: 2,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

printf "Running gofmt checks...\n"
OUTPUT=$(gofmt -d -s .)
OUTPUT=$(gofmt -d .)

if [[ $OUTPUT ]]; then
printf "gofmt found unformatted files:\n\n"
Expand Down
2 changes: 1 addition & 1 deletion gogenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

printf "Running go generate...\n"
go generate ./... && gofmt -s -w -d .
go generate ./... && go fmt ./...

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)
4 changes: 2 additions & 2 deletions services/horizon/internal/db2/history/account_signers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions services/horizon/internal/db2/history/participants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func TestTransactionParticipantsBatch(t *testing.T) {
participants := getTransactionParticipants(tt, q)
tt.Assert.Equal(
[]transactionParticipant{
{TransactionID: 1, AccountID: 100},
{TransactionID: 1, AccountID: 101},
{TransactionID: 1, AccountID: 102},
{TransactionID: 2, AccountID: 100},
transactionParticipant{TransactionID: 1, AccountID: 100},
transactionParticipant{TransactionID: 1, AccountID: 101},
transactionParticipant{TransactionID: 1, AccountID: 102},
transactionParticipant{TransactionID: 2, AccountID: 100},
},
participants,
)
Expand Down
Loading

0 comments on commit 0224737

Please sign in to comment.