-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
build.go: extracts two functions from huge main() #3160
Conversation
// which is what you want for maximum error checking during development. | ||
if flag.NArg() == 0 { | ||
var tags []string | ||
if noupgrade { | ||
tags = []string{"noupgrade"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets lost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems so, but this diff is a bit poor. Look at line 178 (https://github.com/lkwg82/syncthing/blob/github-checks4/build.go#L178) there it is.
I don't know... There's something about these refactorings that just strokes me the wrong way. I can't fully put my finger on it, but one thing is that you for example extract into functions the fairly trivial single-switch-clause for printing the arch warning, but not the admittedly somewhat hairy get-the-current target function... I would have expected the opposite. I'm also not super keen on passing strings and empty targets to a runCommand function - it seems sane to me call that function with a user supplied argument, but since it's a switch clause where most of the legs are just one function call each, |
Do you remember that this was part of a bigger refactoring? So this is just what I thought of I can do better to ease reading the flow. I tried to keep it focused (from my perspective). Maybe I can do another PR, else this will get bigger again ;).
Maybe I can go one step further. I'll have another look into. |
So? |
How to go further? |
@st-review merge it, it's fine build: Extract runCommand from main |
Purpose
extracts
checkArguments
and running commands into two separate functions.Testing
run the build