Make funcNames constant.

Aside from just being a sensible thing to do, this also prevents a local stack allocation.
This commit is contained in:
jholdstock 2020-09-15 10:08:53 +01:00 committed by David Hill
parent f2ae9a81ea
commit d0c3abf258
6 changed files with 8 additions and 8 deletions

View File

@ -64,7 +64,7 @@ func (n *NotificationHandler) Notify(method string, params json.RawMessage) erro
// blockconnected notification is received from dcrd.
func blockConnected() {
funcName := "blockConnected"
const funcName = "blockConnected"
shutdownWg.Add(1)
defer shutdownWg.Done()
@ -363,7 +363,7 @@ func Start(c context.Context, wg *sync.WaitGroup, vdb *database.VspDatabase, drp
// choices.
func checkWalletConsistency() {
funcName := "checkWalletConsistency"
const funcName = "checkWalletConsistency"
log.Info("Checking voting wallet consistency")

View File

@ -64,7 +64,7 @@ func getCurrentFee(dcrdClient *rpc.DcrdRPC) (dcrutil.Amount, error) {
// feeAddress is the handler for "POST /api/v3/feeaddress".
func feeAddress(c *gin.Context) {
funcName := "feeAddress"
const funcName = "feeAddress"
// Get values which have been added to context by middleware.
ticket := c.MustGet("Ticket").(database.Ticket)

View File

@ -116,7 +116,7 @@ func withWalletClients(wallets rpc.WalletConnect) gin.HandlerFunc {
// If no info can be found, the ticket hex will be broadcast.
func broadcastTicket() gin.HandlerFunc {
return func(c *gin.Context) {
funcName := "broadcastTicket"
const funcName = "broadcastTicket"
// Read request bytes and then replace the request reader for
// downstream handlers to use.
@ -201,7 +201,7 @@ func broadcastTicket() gin.HandlerFunc {
// use.
func vspAuth() gin.HandlerFunc {
return func(c *gin.Context) {
funcName := "vspAuth"
const funcName = "vspAuth"
// Read request bytes and then replace the request reader for
// downstream handlers to use.

View File

@ -18,7 +18,7 @@ import (
// payFee is the handler for "POST /api/v3/payfee".
func payFee(c *gin.Context) {
funcName := "payFee"
const funcName = "payFee"
// Get values which have been added to context by middleware.
ticket := c.MustGet("Ticket").(database.Ticket)

View File

@ -14,7 +14,7 @@ import (
// setVoteChoices is the handler for "POST /api/v3/setvotechoices".
func setVoteChoices(c *gin.Context) {
funcName := "setVoteChoices"
const funcName = "setVoteChoices"
// Get values which have been added to context by middleware.
ticket := c.MustGet("Ticket").(database.Ticket)

View File

@ -13,7 +13,7 @@ import (
// ticketStatus is the handler for "POST /api/v3/ticketstatus".
func ticketStatus(c *gin.Context) {
funcName := "ticketStatus"
const funcName = "ticketStatus"
// Get values which have been added to context by middleware.
ticket := c.MustGet("Ticket").(database.Ticket)