Skip to content

Commit

Permalink
fix: linter issue and removing once.Sync for initilization of field o…
Browse files Browse the repository at this point in the history
…f errors.
  • Loading branch information
puni9869 committed May 25, 2024
1 parent 730e936 commit ec8f603
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 1 addition & 5 deletions server/auth/reset_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/puni9869/pinmyblogs/pkg/formbinding"
"github.com/puni9869/pinmyblogs/pkg/logger"
"github.com/puni9869/pinmyblogs/server/middlewares"
"github.com/puni9869/pinmyblogs/types/forms"
Expand All @@ -17,12 +16,9 @@ func ResetPasswordGet(c *gin.Context) {

func ResetPasswordPost(c *gin.Context) {
log := logger.NewLogger()

form := middlewares.GetForm(c).(*forms.ResetForm)
ctx := middlewares.GetContext(c)
// initialize only once
once.Do(func() {
field = new(formbinding.FieldErrors)
})

email := form.Email

Expand Down
6 changes: 2 additions & 4 deletions server/auth/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ func SignupPost(signUp signup.Service) gin.HandlerFunc {
c.Abort()
return
}

field := new(formbinding.FieldErrors)
form := middlewares.GetForm(c).(*forms.SignUpForm)
ctx := middlewares.GetContext(c)

// initialize only once
once.Do(func() {
field = new(formbinding.FieldErrors)
})
password := form.Password
email := form.Email
confirmPassword := form.ConfirmPassword
Expand Down

0 comments on commit ec8f603

Please sign in to comment.