Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailswift committed Jun 12, 2024
1 parent 6571909 commit 4bedc6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ func main() {
log.Println("caught interrupt, waiting for requests to finish...")
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
srv.Shutdown(ctx)
if err := srv.Shutdown(ctx); err != nil {
log.Printf("error shutting down server: %v", err)
}

log.Println("shutting down")
}

Expand Down
10 changes: 9 additions & 1 deletion webhook/github/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package github

import (
"errors"
"fmt"
"io"
"net/http"
Expand All @@ -30,8 +31,15 @@ type Handler struct {

func New(opts ...Option) (webhook.Handler, error) {
h := &Handler{}
errs := make([]error, 0)
for _, opt := range opts {
opt(h)
if err := opt(h); err != nil {
errs = append(errs, err)
}
}

if len(errs) > 0 {
return h, fmt.Errorf("could not create github webhook hanlder: %w", errors.Join(errs...))
}

return h, nil
Expand Down
4 changes: 2 additions & 2 deletions webhook/github/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func init() {
return h, fmt.Errorf("received webhook handler is not a github handler")
}

WithSecretFile(val)(githubHandler)
return githubHandler, nil
err := WithSecretFile(val)(githubHandler)
return githubHandler, err
},
),
)
Expand Down

0 comments on commit 4bedc6c

Please sign in to comment.