Skip to content

Commit

Permalink
silence go vet, staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
dhax committed Jul 24, 2024
1 parent 42b391f commit f59f129
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions api/admin/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ func (rs *AccountResource) create(w http.ResponseWriter, r *http.Request) {
}

if err := rs.Store.Create(data.Account); err != nil {
switch err.(type) {
switch err := err.(type) {
case validation.Errors:
render.Render(w, r, ErrValidation(ErrAccountValidation, err.(validation.Errors)))
render.Render(w, r, ErrValidation(ErrAccountValidation, err))
return
}
render.Render(w, r, ErrInvalidRequest(err))
Expand All @@ -147,9 +147,9 @@ func (rs *AccountResource) update(w http.ResponseWriter, r *http.Request) {
}

if err := rs.Store.Update(acc); err != nil {
switch err.(type) {
switch err := err.(type) {
case validation.Errors:
render.Render(w, r, ErrValidation(ErrAccountValidation, err.(validation.Errors)))
render.Render(w, r, ErrValidation(ErrAccountValidation, err))
return
}
render.Render(w, r, ErrInvalidRequest(err))
Expand Down
4 changes: 2 additions & 2 deletions api/app/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func (rs *AccountResource) update(w http.ResponseWriter, r *http.Request) {
}

if err := rs.Store.Update(acc); err != nil {
switch err.(type) {
switch err := err.(type) {
case validation.Errors:
render.Render(w, r, ErrValidation(ErrAccountValidation, err.(validation.Errors)))
render.Render(w, r, ErrValidation(ErrAccountValidation, err))
return
}
render.Render(w, r, ErrRender(err))
Expand Down
4 changes: 2 additions & 2 deletions api/app/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func (rs *ProfileResource) update(w http.ResponseWriter, r *http.Request) {
}

if err := rs.Store.Update(p); err != nil {
switch err.(type) {
switch err := err.(type) {
case validation.Errors:
render.Render(w, r, ErrValidation(ErrProfileValidation, err.(validation.Errors)))
render.Render(w, r, ErrValidation(ErrProfileValidation, err))
return
}
render.Render(w, r, ErrRender(err))
Expand Down
2 changes: 1 addition & 1 deletion api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (srv *Server) Start() {
}()
log.Printf("Listening on %s\n", srv.Addr)

quit := make(chan os.Signal)
quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt)
sig := <-quit
log.Println("Shutting down server... Reason:", sig)
Expand Down
4 changes: 2 additions & 2 deletions email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewMailer() (*Mailer, error) {
}

s := &Mailer{
client: mail.NewPlainDialer(smtp.Host, smtp.Port, smtp.User, smtp.Password),
client: mail.NewDialer(smtp.Host, smtp.Port, smtp.User, smtp.Password),
from: NewEmail(viper.GetString("email_from_name"), viper.GetString("email_from_address")),
}

Expand Down Expand Up @@ -157,7 +157,7 @@ func formatAsDate(t time.Time) string {
}

func formatAsDuration(t time.Time) string {
dur := t.Sub(time.Now())
dur := time.Until(t)
hours := int(dur.Hours())
mins := int(dur.Minutes())

Expand Down

0 comments on commit f59f129

Please sign in to comment.