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

Global Shennanigans #1436

Open
l0k18 opened this issue Jun 5, 2019 · 1 comment
Open

Global Shennanigans #1436

l0k18 opened this issue Jun 5, 2019 · 1 comment

Comments

@l0k18
Copy link
Contributor

l0k18 commented Jun 5, 2019

btcd/btcd.go

Line 31 in 1503795

cfg *config

This little monster is ultra bad bad bad, especially because in the main package, several functions ho further to compound the mischief by having cfg as parameter names, as well, to make it even harder to track down things by making the search function frustratingly non-selective as 'cfg' has at least 2 maybe more different instances that are addressible from within the btcd main package.

Here is at least one other in the same package, inside a function block namespace:

btcd/config.go

Line 407 in 1503795

cfg := config{

I unfortunately mutated the code I have been working on quite drastically since I started on my fork for parallelcoin but I confirm there above that this is not my error, and I am filing this issue because nobody else has and this is a really really knotty bit of ultra smelly code smell and just imho, it should be fixed as a matter of priority before the spaghetti breaks something.

The other thing is that this completely precludes the easy creation of test harnesses for the main btcd node without using external launching tools.

@ghost
Copy link

ghost commented Jul 9, 2019

I see your points @4avka, it is a global, and local variables created using the same name, so its not clear which is being worked on. What approach you would take to clean it up, anything more than renaming it to indicate its global scope?

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

1 participant