Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten Github issue template and add test example #2711

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
### Issue Description

### Checklist
### Working code to debug

- [ ] Dependencies installed
- [ ] No typos
- [ ] Searched existing issues and docs
```go
package main

### Expected behaviour
import (
"github.com/labstack/echo/v4"
"net/http"
"net/http/httptest"
"testing"
)

### Actual behaviour
func TestExample(t *testing.T) {
e := echo.New()

### Steps to reproduce
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})

### Working code to debug
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()

```go
package main
e.ServeHTTP(rec, req)

func main() {
if rec.Code != http.StatusOK {
t.Errorf("got %d, want %d", rec.Code, http.StatusOK)
}
}
```

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ package main
import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"log/slog"
"net/http"
)

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

// Start server
e.Logger.Fatal(e.Start(":1323"))
if err := e.Start(":8080"); err != nil && !errors.Is(err, http.ErrServerClosed) {
slog.Error("failed to start server", "error", err)
}
}

// Handler
Expand Down
Loading