Skip to content

Commit

Permalink
fix: invalid goroutine option
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-shin0 committed Apr 25, 2024
1 parent 37c02f3 commit 57537e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions autopprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ func TestStart(t *testing.T) {
},
want: ErrInvalidMemThreshold,
},
{
name: "invalid GoroutineThreshold value",
opt: Option{
GoroutineThreshold: -1,
},
want: ErrInvalidGoroutineThreshold,
},
{
name: "when given reporter is nil",
opt: Option{
Expand Down
2 changes: 1 addition & 1 deletion option.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (o Option) validate() error {
if o.MemThreshold < 0 || o.MemThreshold > 1 {
return ErrInvalidMemThreshold
}
if o.GoroutineThreshold <= 0 {
if o.GoroutineThreshold < 0 {
return ErrInvalidGoroutineThreshold
}
if o.Reporter == nil {
Expand Down

0 comments on commit 57537e9

Please sign in to comment.