ci: add linter
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
package hello
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func HelloHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Hello, World!"))
|
||||
}
|
||||
func Handler(w http.ResponseWriter, _ *http.Request) {
|
||||
_, _ = w.Write([]byte("Hello, World!"))
|
||||
|
||||
if true {
|
||||
if true {
|
||||
if true {
|
||||
fmt.Println("Deeply nested condition")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package hello
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHelloHandler(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
req := httptest.NewRequest("GET", "/hello", nil)
|
||||
HelloHandler(w, req)
|
||||
Handler(w, req)
|
||||
expected := "Hello, World!"
|
||||
if w.Body.String() != expected {
|
||||
t.Errorf("Expected %q but got %q", expected, w.Body.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user