Skip to content

Commit

Permalink
chore: lint and update go version
Browse files Browse the repository at this point in the history
  • Loading branch information
puria committed Sep 19, 2024
1 parent 4291070 commit c642468
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/dyne/mattermost_commands

go 1.22
go 1.23
18 changes: 14 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package main

import (
"log"
"net/http"
"net/http"
"time"
)

func main() {
handler := http.HandlerFunc(MiniServer)
log.Fatal(http.ListenAndServe(":4444", handler))
handler := http.HandlerFunc(MiniServer)

server := &http.Server{
Addr: ":4444",
ReadHeaderTimeout: 3 * time.Second,
Handler: handler,
}

err := server.ListenAndServe()
if err != nil {
panic(err)
}
}
5 changes: 4 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ It'll be great to have you there—let's connect and make it a good one! 💫
`, address, r.FormValue("user_name"))
data := Notification{text, "in_channel", address}
w.Header().Set("Content-type", "application/json")
json.NewEncoder(w).Encode(&data)
err = json.NewEncoder(w).Encode(&data)
if err != nil {
panic(err)
}
}

func getEncodedAddress(path string) string {
Expand Down

0 comments on commit c642468

Please sign in to comment.