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

Fix bug in delAll() #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

andpol
Copy link

@andpol andpol commented Jan 29, 2019

Before this change, a SIGTERM resulted in the following:

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/andreas-schroeder/kafka-health-check/check.delAt(0xc000018630, 0x6, 0x9, 0x6, 0xc000018630, 0x6, 0x9)
	/go/src/github.com/andreas-schroeder/kafka-health-check/check/int32_slice.go:27 +0x1f3
github.com/andreas-schroeder/kafka-health-check/check.delAll(0xc000018630, 0x8, 0x9, 0xc000000007, 0x1, 0xc0001aaa10, 0x6)
	/go/src/github.com/andreas-schroeder/kafka-health-check/check/int32_slice.go:35 +0x187
github.com/andreas-schroeder/kafka-health-check/check.(*HealthCheck).deleteTopic(0xc0000f0000, 0x798420, 0xc00000e040, 0xc0001aaa10, 0x6, 0x748196, 0x18, 0x0, 0x0, 0x0)
	/go/src/github.com/andreas-schroeder/kafka-health-check/check/setup.go:315 +0x31e
github.com/andreas-schroeder/kafka-health-check/check.(*HealthCheck).closeConnection(0xc0000f0000, 0x1)
	/go/src/github.com/andreas-schroeder/kafka-health-check/check/setup.go:294 +0x253
github.com/andreas-schroeder/kafka-health-check/check.(*HealthCheck).CheckHealth(0xc0000f0000, 0xc000128000, 0xc000128060, 0xc00001e180)
	/go/src/github.com/andreas-schroeder/kafka-health-check/check/health_check.go:107 +0x7f0
main.main()
	/go/src/github.com/andreas-schroeder/kafka-health-check/main.go:20 +0x150

This change fixes the bug on line 28 of check/int32_slice.go and adds tests.

@andpol andpol mentioned this pull request Jan 29, 2019
make test complains with:
> check/health_check.go:115: Warn call has possible formatting directive %s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant