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

Boolean flags ignore value #193

Closed
apaperclip opened this issue Jun 17, 2021 · 1 comment
Closed

Boolean flags ignore value #193

apaperclip opened this issue Jun 17, 2021 · 1 comment

Comments

@apaperclip
Copy link
Contributor

I think I may found a bug where a value of false for -unique will trigger the case statement for enabling unique message deduplication.

When using -unique=false I am getting deduped results. This may seem like a silly test since the default is false. I came across this by using the metermon project which sets this to true by default, Overriding the value with the rtlamr_unique env variable to false did not have the desired affect. So I tested rtlamr directly and found that setting the flag to false still dedupes.

I also recreated the issue with the latest bemasher/rtlamr docker hub image.

@bemasher
Copy link
Owner

You are correct. In go's standard flags package, boolean flags don't need to be specified with a value, so the current logic only checks for existence of the flag. See below.

https://github.com/bemasher/rtlamr/blob/master/main.go#L96-L111

I see where it may be useful to always specify a flag and instead change the value passed when controlling rtlamr with another process. Luckily, the fix is easy, I'll work on it.

@bemasher bemasher changed the title Possible issue with unique flag logic? Boolean flags ignore value Jun 17, 2021
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

No branches or pull requests

2 participants