Skip to content

Commit 65eeb45

Browse files
authored
chore: golines (#245)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 0d7a9b0 commit 65eeb45

File tree

7 files changed

+73
-40
lines changed

7 files changed

+73
-40
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ clean:
2828
format: mod-tidy
2929
go fmt ./...
3030

31+
golines:
32+
golines -w --ignore-generated --chain-split-dots --max-len=80 --reformat-tags .
33+
3134
swagger:
3235
swag f -g api.go -d api,output
3336
swag i -g api.go -d api,output

docs/docs.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

input/chainsync/chainsync.go

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,22 +225,35 @@ func (c *ChainSync) setupConnection() error {
225225
if c.autoReconnect {
226226
c.autoReconnectDelay = 0
227227
if c.logger != nil {
228-
c.logger.Infof("reconnecting to %s due to error: %s", c.dialAddress, err)
228+
c.logger.Infof(
229+
"reconnecting to %s due to error: %s",
230+
c.dialAddress,
231+
err,
232+
)
229233
}
230234
for {
231235
if c.autoReconnectDelay > 0 {
232-
c.logger.Infof("waiting %s to reconnect", c.autoReconnectDelay)
236+
c.logger.Infof(
237+
"waiting %s to reconnect",
238+
c.autoReconnectDelay,
239+
)
233240
time.Sleep(c.autoReconnectDelay)
234241
// Double current reconnect delay up to maximum
235-
c.autoReconnectDelay = min(c.autoReconnectDelay*2, maxAutoReconnectDelay)
242+
c.autoReconnectDelay = min(
243+
c.autoReconnectDelay*2,
244+
maxAutoReconnectDelay,
245+
)
236246
} else {
237247
// Set initial reconnect delay
238248
c.autoReconnectDelay = 1 * time.Second
239249
}
240250
// Shutdown current connection
241251
if err := c.oConn.Close(); err != nil {
242252
if c.logger != nil {
243-
c.logger.Warnf("failed to properly close connection: %s", err)
253+
c.logger.Warnf(
254+
"failed to properly close connection: %s",
255+
err,
256+
)
244257
}
245258
}
246259
// Set the intersect points from the cursor cache
@@ -250,7 +263,11 @@ func (c *ChainSync) setupConnection() error {
250263
// Restart the connection
251264
if err := c.Start(); err != nil {
252265
if c.logger != nil {
253-
c.logger.Infof("reconnecting to %s due to error: %s", c.dialAddress, err)
266+
c.logger.Infof(
267+
"reconnecting to %s due to error: %s",
268+
c.dialAddress,
269+
err,
270+
)
254271
}
255272
continue
256273
}
@@ -309,7 +326,11 @@ func (c *ChainSync) handleRollForward(
309326
return nil
310327
}
311328

312-
func (c *ChainSync) handleBlockFetchBlock(ctx blockfetch.CallbackContext, blockType uint, block ledger.Block) error {
329+
func (c *ChainSync) handleBlockFetchBlock(
330+
ctx blockfetch.CallbackContext,
331+
blockType uint,
332+
block ledger.Block,
333+
) error {
313334
blockEvt := event.New(
314335
"chainsync.block",
315336
time.Now(),
@@ -356,7 +377,10 @@ func (c *ChainSync) updateStatus(
356377
) {
357378
// Update cursor cache
358379
blockHashBytes, _ := hex.DecodeString(blockHash)
359-
c.cursorCache = append(c.cursorCache, ocommon.Point{Slot: slotNumber, Hash: blockHashBytes})
380+
c.cursorCache = append(
381+
c.cursorCache,
382+
ocommon.Point{Slot: slotNumber, Hash: blockHashBytes},
383+
)
360384
if len(c.cursorCache) > cursorCacheSize {
361385
c.cursorCache = c.cursorCache[len(c.cursorCache)-cursorCacheSize:]
362386
}

input/chainsync/tx.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ func NewTransactionEvent(
6262
includeCbor bool,
6363
) TransactionEvent {
6464
evt := TransactionEvent{
65-
Transaction: tx,
66-
BlockHash: block.Hash(),
67-
Inputs: tx.Inputs(),
68-
Outputs: tx.Outputs(),
69-
Fee: tx.Fee(),
65+
Transaction: tx,
66+
BlockHash: block.Hash(),
67+
Inputs: tx.Inputs(),
68+
Outputs: tx.Outputs(),
69+
Fee: tx.Fee(),
7070
}
7171
if includeCbor {
7272
evt.TransactionCbor = tx.Cbor()

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Config struct {
4343

4444
type ApiConfig struct {
4545
ListenAddress string `yaml:"address" envconfig:"API_ADDRESS"`
46-
ListenPort uint `yaml:"port" envconfig:"API_PORT"`
46+
ListenPort uint `yaml:"port" envconfig:"API_PORT"`
4747
}
4848

4949
type LoggingConfig struct {

output/notify/notify.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ func (n *NotifyOutput) Start() error {
5555
if err != nil {
5656
return err
5757
}
58-
if _, err := os.Stat(fmt.Sprintf("%s/%s", userCacheDir, "adder")); os.IsNotExist(err) {
59-
err = os.MkdirAll(fmt.Sprintf("%s/%s", userCacheDir, "adder"), os.ModePerm)
58+
if _, err := os.Stat(fmt.Sprintf("%s/%s", userCacheDir, "adder")); os.IsNotExist(
59+
err,
60+
) {
61+
err = os.MkdirAll(
62+
fmt.Sprintf("%s/%s", userCacheDir, "adder"),
63+
os.ModePerm,
64+
)
6065
if err != nil {
6166
panic(err)
6267
}

output/push/fcm_repository.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ func getTokenStore() *TokenStore {
6060
return fcmStore
6161
}
6262

63-
// @Summary Store FCM Token
64-
// @Description Store a new FCM token
65-
// @Accept json
66-
// @Produce json
67-
// @Param body body TokenRequest true "FCM Token Request"
68-
// @Success 201 {string} string "Created"
69-
// @Failure 400 {object} ErrorResponse
70-
// @Router /fcm [post]
63+
// @Summary Store FCM Token
64+
// @Description Store a new FCM token
65+
// @Accept json
66+
// @Produce json
67+
// @Param body body TokenRequest true "FCM Token Request"
68+
// @Success 201 {string} string "Created"
69+
// @Failure 400 {object} ErrorResponse
70+
// @Router /fcm [post]
7171
func storeFCMToken(c *gin.Context) {
7272
var req TokenRequest
7373

@@ -81,14 +81,14 @@ func storeFCMToken(c *gin.Context) {
8181
c.Status(http.StatusCreated)
8282
}
8383

84-
// @Summary Get FCM Token
85-
// @Description Get an FCM token by its value
86-
// @Accept json
87-
// @Produce json
88-
// @Param token path string true "FCM Token"
89-
// @Success 200 {object} TokenResponse
90-
// @Failure 404 {object} ErrorResponse
91-
// @Router /fcm/{token} [get]
84+
// @Summary Get FCM Token
85+
// @Description Get an FCM token by its value
86+
// @Accept json
87+
// @Produce json
88+
// @Param token path string true "FCM Token"
89+
// @Success 200 {object} TokenResponse
90+
// @Failure 404 {object} ErrorResponse
91+
// @Router /fcm/{token} [get]
9292
func readFCMToken(c *gin.Context) {
9393
token := c.Param("token")
9494
store := getTokenStore()
@@ -100,14 +100,14 @@ func readFCMToken(c *gin.Context) {
100100
c.JSON(http.StatusOK, gin.H{"fcmToken": storedToken})
101101
}
102102

103-
// @Summary Delete FCM Token
104-
// @Description Delete an FCM token by its value
105-
// @Accept json
106-
// @Produce json
107-
// @Param token path string true "FCM Token"
108-
// @Success 204 {string} string "No Content"
109-
// @Failure 404 {object} ErrorResponse
110-
// @Router /fcm/{token} [delete]
103+
// @Summary Delete FCM Token
104+
// @Description Delete an FCM token by its value
105+
// @Accept json
106+
// @Produce json
107+
// @Param token path string true "FCM Token"
108+
// @Success 204 {string} string "No Content"
109+
// @Failure 404 {object} ErrorResponse
110+
// @Router /fcm/{token} [delete]
111111
func deleteFCMToken(c *gin.Context) {
112112
token := c.Param("token")
113113
store := getTokenStore()

0 commit comments

Comments
 (0)