Skip to content

Commit

Permalink
Bug Fix: golangci-linter checks
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjamenMeyer committed Dec 5, 2022
1 parent 4410368 commit 2eb4b2d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ test:
coverage: test
go tool cover -html=.coverage
go tool cover -func=.coverage

lint:
golangci-lint run
4 changes: 2 additions & 2 deletions common/call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Test_Common_HttpCall(t *testing.T) {
Headers: http.Header{},
Request: &http.Request{},
}
if hc == nil {
t.Error("Unexpected nil")
if hc.Method != "test" {
t.Errorf("Failed to set method")
}
}
4 changes: 2 additions & 2 deletions common/reply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Test_Common_HttpReply(t *testing.T) {
Status: common.HttpStatus_RouteNotHandled,
Headers: http.Header{},
}
if hr == nil {
t.Error("Unexpected nil")
if hr.Status != common.HttpStatus_RouteNotHandled {
t.Errorf("Failed to set Status")
}
}
2 changes: 1 addition & 1 deletion router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Test_Router_Router(t *testing.T) {
func(t *testing.T) {
irt := router.New()
if irt == nil {
t.Errorf("New generated a nil pointer")
t.Fatal("New generated a nil pointer")
}
if irt.RequestHandlers == nil {
t.Errorf("New did not create the route table")
Expand Down
10 changes: 8 additions & 2 deletions service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ func TestService(t *testing.T) {
scenario.name,
func(t *testing.T) {
handler := service.ServiceHandler{}
handler.Init(
initErr := handler.Init(
scenario.name,
&common.BasicServerURI{},
)
if initErr != nil {
t.Errorf("Failed to initialize the service handler: %#v", initErr)
}

parameters := scenario.setup(t)

Expand Down Expand Up @@ -157,13 +160,16 @@ func TestService(t *testing.T) {
scenario.name,
func(t *testing.T) {
handler := service.ServiceHandler{}
handler.Init(
initErr := handler.Init(
scenario.name,
&common.BasicServerURI{
Protocol: "http",
Host: "example.com",
},
)
if initErr != nil {
t.Errorf("Failed to initialize the service handler: %#v", initErr)
}

parameters := scenario.setup(t)

Expand Down

0 comments on commit 2eb4b2d

Please sign in to comment.