Skip to content

Commit 9e73691

Browse files
committed
Shorten Github issue template and add test example
1 parent 118c163 commit 9e73691

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

.github/ISSUE_TEMPLATE.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
### Issue Description
22

3-
### Checklist
3+
### Working code to debug
44

5-
- [ ] Dependencies installed
6-
- [ ] No typos
7-
- [ ] Searched existing issues and docs
5+
```go
6+
package main
87

9-
### Expected behaviour
8+
import (
9+
"github.com/labstack/echo/v4"
10+
"net/http"
11+
"net/http/httptest"
12+
"testing"
13+
)
1014

11-
### Actual behaviour
15+
func TestExample(t *testing.T) {
16+
e := echo.New()
1217

13-
### Steps to reproduce
18+
e.GET("/", func(c echo.Context) error {
19+
return c.String(http.StatusOK, "Hello, World!")
20+
})
1421

15-
### Working code to debug
22+
req := httptest.NewRequest(http.MethodGet, "/", nil)
23+
rec := httptest.NewRecorder()
1624

17-
```go
18-
package main
25+
e.ServeHTTP(rec, req)
1926

20-
func main() {
27+
if rec.Code != http.StatusOK {
28+
t.Errorf("got %d, want %d", rec.Code, http.StatusOK)
29+
}
2130
}
2231
```
2332

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ package main
7575
import (
7676
"github.com/labstack/echo/v4"
7777
"github.com/labstack/echo/v4/middleware"
78+
"log/slog"
7879
"net/http"
7980
)
8081

@@ -90,7 +91,9 @@ func main() {
9091
e.GET("/", hello)
9192

9293
// Start server
93-
e.Logger.Fatal(e.Start(":1323"))
94+
if err := e.Start(":8080"); err != nil && !errors.Is(err, http.ErrServerClosed) {
95+
slog.Error("failed to start server", "error", err)
96+
}
9497
}
9598

9699
// Handler

0 commit comments

Comments
 (0)