Skip to content

Commit c635297

Browse files
authored
chore: make format golines (#637)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent e7f2e2e commit c635297

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+661
-183
lines changed

cbor/tags.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ var customTagSet _cbor.TagSet
4242
func init() {
4343
// Build custom tagset
4444
customTagSet = _cbor.NewTagSet()
45-
tagOpts := _cbor.TagOptions{EncTag: _cbor.EncTagRequired, DecTag: _cbor.DecTagRequired}
45+
tagOpts := _cbor.TagOptions{
46+
EncTag: _cbor.EncTagRequired,
47+
DecTag: _cbor.DecTagRequired,
48+
}
4649
// Wrapped CBOR
4750
if err := customTagSet.Add(
4851
tagOpts,

cbor/value.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ func (c *Constructor) UnmarshalCBOR(data []byte) error {
290290
if _, err := Decode(tmpTag.Content, &tmpValue); err != nil {
291291
return err
292292
}
293-
if tmpTag.Number >= CborTagAlternative1Min && tmpTag.Number <= CborTagAlternative1Max {
293+
if tmpTag.Number >= CborTagAlternative1Min &&
294+
tmpTag.Number <= CborTagAlternative1Max {
294295
// Alternatives 0-6
295296
c.constructor = uint(tmpTag.Number - CborTagAlternative1Min)
296297
c.value = &tmpValue

cbor/value_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ func TestConstructorDecode(t *testing.T) {
336336
testDef.expectedObj.Constructor(),
337337
)
338338
}
339-
if !reflect.DeepEqual(tmpConstr.Fields(), testDef.expectedObj.Fields()) {
339+
if !reflect.DeepEqual(
340+
tmpConstr.Fields(),
341+
testDef.expectedObj.Fields(),
342+
) {
340343
t.Fatalf(
341344
"did not decode to expected fields\n got: %#v\n wanted: %#v",
342345
tmpConstr.Fields(),

cmd/gouroboros/chainsync.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ func testChainSync(f *globalFlags) {
261261
select {}
262262
}
263263

264-
func chainSyncRollBackwardHandler(ctx chainsync.CallbackContext, point common.Point, tip chainsync.Tip) error {
264+
func chainSyncRollBackwardHandler(
265+
ctx chainsync.CallbackContext,
266+
point common.Point,
267+
tip chainsync.Tip,
268+
) error {
265269
fmt.Printf("roll backward: point = %#v, tip = %#v\n", point, tip)
266270
return nil
267271
}
@@ -318,7 +322,10 @@ func chainSyncRollForwardHandler(
318322
return nil
319323
}
320324

321-
func blockFetchBlockHandler(ctx blockfetch.CallbackContext, blockData ledger.Block) error {
325+
func blockFetchBlockHandler(
326+
ctx blockfetch.CallbackContext,
327+
blockData ledger.Block,
328+
) error {
322329
switch block := blockData.(type) {
323330
case *ledger.ByronEpochBoundaryBlock:
324331
fmt.Printf("era = Byron (EBB), epoch = %d, slot = %d, id = %s\n", block.Header.ConsensusData.Epoch, block.SlotNumber(), block.Hash())

cmd/gouroboros/query.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ func testQuery(f *globalFlags) {
191191
}
192192
tmpPools = append(tmpPools, tmpPoolId)
193193
}
194-
poolParams, err := o.LocalStateQuery().Client.GetStakePoolParams(tmpPools)
194+
poolParams, err := o.LocalStateQuery().Client.GetStakePoolParams(
195+
tmpPools,
196+
)
195197
if err != nil {
196198
fmt.Printf("ERROR: failure querying stake pool params: %s\n", err)
197199
os.Exit(1)

cmd/tx-submission/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ func main() {
118118
// convert to tx
119119
txType, err := ledger.DetermineTransactionType(txBytes)
120120
if err != nil {
121-
fmt.Printf("ERROR: could not parse transaction to determine type: %s", err)
121+
fmt.Printf(
122+
"ERROR: could not parse transaction to determine type: %s",
123+
err,
124+
)
122125
os.Exit(1)
123126
}
124127
tx, err := ledger.NewTransactionFromCbor(txType, txBytes)

connection.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ func (c *Connection) Dial(proto string, address string) error {
146146
// passed to the [net.DialTimeout] func. The handshake will be started when a connection is established.
147147
// An error will be returned if the connection fails, a connection was already established, or the
148148
// handshake fails
149-
func (c *Connection) DialTimeout(proto string, address string, timeout time.Duration) error {
149+
func (c *Connection) DialTimeout(
150+
proto string,
151+
address string,
152+
timeout time.Duration,
153+
) error {
150154
if c.conn != nil {
151155
return fmt.Errorf("a connection was already established")
152156
}
@@ -310,17 +314,19 @@ func (c *Connection) setupConnection() error {
310314
var handshakeFullDuplex bool
311315
handshakeConfig := handshake.NewConfig(
312316
handshake.WithProtocolVersionMap(protoVersions),
313-
handshake.WithFinishedFunc(func(ctx handshake.CallbackContext, version uint16, versionData protocol.VersionData) error {
314-
c.handshakeVersion = version
315-
c.handshakeVersionData = versionData
316-
if c.useNodeToNodeProto {
317-
if versionData.DiffusionMode() == protocol.DiffusionModeInitiatorAndResponder {
318-
handshakeFullDuplex = true
317+
handshake.WithFinishedFunc(
318+
func(ctx handshake.CallbackContext, version uint16, versionData protocol.VersionData) error {
319+
c.handshakeVersion = version
320+
c.handshakeVersionData = versionData
321+
if c.useNodeToNodeProto {
322+
if versionData.DiffusionMode() == protocol.DiffusionModeInitiatorAndResponder {
323+
handshakeFullDuplex = true
324+
}
319325
}
320-
}
321-
close(c.handshakeFinishedChan)
322-
return nil
323-
}),
326+
close(c.handshakeFinishedChan)
327+
return nil
328+
},
329+
),
324330
)
325331
c.handshake = handshake.New(protoOptions, &handshakeConfig)
326332
if c.server {

connection_manager.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ func NewConnectionManager(cfg ConnectionManagerConfig) *ConnectionManager {
7878
}
7979
}
8080

81-
func (c *ConnectionManager) AddHost(address string, port uint, tags ...ConnectionManagerTag) {
81+
func (c *ConnectionManager) AddHost(
82+
address string,
83+
port uint,
84+
tags ...ConnectionManagerTag,
85+
) {
8286
tmpTags := map[ConnectionManagerTag]bool{}
8387
for _, tag := range tags {
8488
tmpTags[tag] = true
@@ -99,12 +103,20 @@ func (c *ConnectionManager) AddHostsFromTopology(topology *TopologyConfig) {
99103
}
100104
for _, localRoot := range topology.LocalRoots {
101105
for _, host := range localRoot.AccessPoints {
102-
c.AddHost(host.Address, host.Port, ConnectionManagerTagHostLocalRoot)
106+
c.AddHost(
107+
host.Address,
108+
host.Port,
109+
ConnectionManagerTagHostLocalRoot,
110+
)
103111
}
104112
}
105113
for _, publicRoot := range topology.PublicRoots {
106114
for _, host := range publicRoot.AccessPoints {
107-
c.AddHost(host.Address, host.Port, ConnectionManagerTagHostPublicRoot)
115+
c.AddHost(
116+
host.Address,
117+
host.Port,
118+
ConnectionManagerTagHostPublicRoot,
119+
)
108120
}
109121
}
110122
}
@@ -129,13 +141,17 @@ func (c *ConnectionManager) RemoveConnection(connId ConnectionId) {
129141
c.connectionsMutex.Unlock()
130142
}
131143

132-
func (c *ConnectionManager) GetConnectionById(connId ConnectionId) *ConnectionManagerConnection {
144+
func (c *ConnectionManager) GetConnectionById(
145+
connId ConnectionId,
146+
) *ConnectionManagerConnection {
133147
c.connectionsMutex.Lock()
134148
defer c.connectionsMutex.Unlock()
135149
return c.connections[connId]
136150
}
137151

138-
func (c *ConnectionManager) GetConnectionsByTags(tags ...ConnectionManagerTag) []*ConnectionManagerConnection {
152+
func (c *ConnectionManager) GetConnectionsByTags(
153+
tags ...ConnectionManagerTag,
154+
) []*ConnectionManagerConnection {
139155
var ret []*ConnectionManagerConnection
140156
c.connectionsMutex.Lock()
141157
for _, conn := range c.connections {

connection_manager_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,18 @@ func TestConnectionManagerConnError(t *testing.T) {
5656
ConnClosedFunc: func(connId ouroboros.ConnectionId, err error) {
5757
if err != nil {
5858
if connId != expectedConnId {
59-
t.Fatalf("did not receive error from expected connection: got %d, wanted %d", connId, expectedConnId)
59+
t.Fatalf(
60+
"did not receive error from expected connection: got %d, wanted %d",
61+
connId,
62+
expectedConnId,
63+
)
6064
}
6165
if err != expectedErr {
62-
t.Fatalf("did not receive expected error: got: %s, expected: %s", err, expectedErr)
66+
t.Fatalf(
67+
"did not receive expected error: got: %s, expected: %s",
68+
err,
69+
expectedErr,
70+
)
6371
}
6472
close(doneChan)
6573
}
@@ -121,7 +129,11 @@ func TestConnectionManagerConnClosed(t *testing.T) {
121129
ouroboros.ConnectionManagerConfig{
122130
ConnClosedFunc: func(connId ouroboros.ConnectionId, err error) {
123131
if connId != expectedConnId {
124-
t.Fatalf("did not receive closed signal from expected connection: got %d, wanted %d", connId, expectedConnId)
132+
t.Fatalf(
133+
"did not receive closed signal from expected connection: got %d, wanted %d",
134+
connId,
135+
expectedConnId,
136+
)
125137
}
126138
if err != nil {
127139
t.Fatalf("received unexpected error: %s", err)

ledger/alonzo.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,15 @@ func NewAlonzoTransactionFromCbor(data []byte) (*AlonzoTransaction, error) {
452452
return &alonzoTx, nil
453453
}
454454

455-
func NewAlonzoTransactionOutputFromCbor(data []byte) (*AlonzoTransactionOutput, error) {
455+
func NewAlonzoTransactionOutputFromCbor(
456+
data []byte,
457+
) (*AlonzoTransactionOutput, error) {
456458
var alonzoTxOutput AlonzoTransactionOutput
457459
if _, err := cbor.Decode(data, &alonzoTxOutput); err != nil {
458-
return nil, fmt.Errorf("Alonzo transaction output decode error: %s", err)
460+
return nil, fmt.Errorf(
461+
"Alonzo transaction output decode error: %s",
462+
err,
463+
)
459464
}
460465
return &alonzoTxOutput, nil
461466
}

0 commit comments

Comments
 (0)