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

Empty featuregate values will happen to be a panic #5663

Merged

Conversation

matianjun1
Copy link
Contributor

Description:
Fixing a bug - Empty featuregate values will happen to be a panic

FlagValue.Set("")

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
go.opentelemetry.io/collector/service/featuregate.FlagValue.setSlice(...)
	/xxx/go/pkg/mod/go.opentelemetry.io/collector@v0.55.0/service/featuregate/flags.go:54
go.opentelemetry.io/collector/service/featuregate.FlagValue.Set(0x105f26828?, {0x0?, 0x0?})
	/xxx/go/pkg/mod/go.opentelemetry.io/collector@v0.55.0/service/featuregate/flags.go:47 +0x14c

Testing:

Add an empty flag test

Documentation:

Just check if the input string is empty, and return directly.

@matianjun1 matianjun1 requested review from a team and mx-psi July 10, 2022 07:02
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 10, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: matianjun1 / name: Chinese.马天骏 (8632ba6)

@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #5663 (0733778) into main (58e66af) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5663   +/-   ##
=======================================
  Coverage   91.41%   91.42%           
=======================================
  Files         191      191           
  Lines       11386    11389    +3     
=======================================
+ Hits        10409    10412    +3     
  Misses        778      778           
  Partials      199      199           
Impacted Files Coverage Δ
service/featuregate/flags.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58e66af...0733778. Read the comment docs.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 thanks for the PR, could you add a changelog entry?

Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codeboten codeboten merged commit e319cbe into open-telemetry:main Jul 11, 2022
@matianjun1 matianjun1 deleted the allow_empty_featuregate_value branch July 12, 2022 02:01
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.

4 participants