8000 Simplify if-else chains and spacing by tmrts · Pull Request #2453 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is n 8000 ow read-only.

Simplify if-else chains and spacing #2453

Merged
merged 1 commit into from
May 12, 2016
Merged

Conversation

tmrts
Copy link
Contributor
@tmrts tmrts commented Apr 19, 2016

Refactors the if-else chains for readability

Fixes #2421

@tmrts tmrts changed the title rkt: simplify if-else chains and spacing Simplify if-else chains and spacing Apr 19, 2016
@s-urbaniak s-urbaniak added this to the v1.5.0 milestone Apr 19, 2016
@s-urbaniak
Copy link
Contributor

LGTM

@jonboulle
Copy link
Contributor

Do we have tests covering this path?

Sergiusz Urbaniak notifications@github.com schrieb am Di., 19. Apr. 2016,
09:43:

LGTM


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#2453 (comment)

@alban
Copy link
Member
alban commented Apr 19, 2016

I don't think we have tests. The closest we have about config rktKind=paths seems to be in https://github.com/coreos/rkt/blob/master/tests/rkt_stage1_loading_test.go#L545

@tmrts tmrts force-pushed the simplify/calculateDataDir branch from 46a5741 to bbb8bf4 Compare April 19, 2016 08:52
@tmrts
Copy link
Contributor Author
tmrts commented Apr 19, 2016

I didn't add tests since methods were not exposed, but the best action would be to extract config methods out and create a new testable package

@@ -181,7 +183,9 @@ func init() {

func getTabOutWithWriter(writer io.Writer) *tabwriter.Writer {
aTabOut := new(tabwriter.Writer)

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you adding all these blank lines or is some tool you're using doing it?

Copy link
Contributor Author
@tmrts tmrts Apr 19, 2016

Choose a reason for hiding this comment

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

I'm adding a new lines to logically group statements suggested by Effective Go docs. It's hard to read when the code is cluttered.

Copy link
Contributor

Choose a reason for hiding this comment

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

reference? I can't find anything (looking for "logic", "group",
"statements", "newlines") in https://golang.org/doc/effective_go.html - and
indeed all of the code examples there seem to suggest otherwise

On Tue, Apr 19, 2016 at 1:53 PM, Tamer TAS notifications@github.com wrote:

In rkt/rkt.go
#2453 (comment):

@@ -181,7 +183,9 @@ func init() {

func getTabOutWithWriter(writer io.Writer) *tabwriter.Writer {
aTabOut := new(tabwriter.Writer)
+

I'm adding a new lines to logically group statements suggested by Effective
Go docs.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/coreos/rkt/pull/2453/files/bbb8bf451a4cabc67e74f03103df18b24a2a5219#r60216890

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must be confusing it with another guide, but using blank spaces to logically grouping statements improves code quality. From the functions I've read, there are a lot of clustered statements. I believe blank spaces would help with readability and blank spaces are cheap :)

@jonboulle
Copy link
Contributor

Nothing looks wrong with this to me (aside from the superfluous spacing which I'm unsure about), but I'm pushing back on the tests because sometimes the most innocuous-looking refactorings can introduce the most "fun" bugs... @tmrts would you mind exploring adding something?

@tmrts
Copy link
Contributor Author
tmrts commented Apr 19, 2016

@jonboulle I agree with your statement completely (except your comments about spacing :). I'll try to refactor this package or add tests to it then extract it in another PR.

@s-urbaniak s-urbaniak modified the milestones: v1.6.0, v1.5.0 Apr 28, 2016
@tmrts tmrts force-pushed the simplify/calculateDataDir branch from bbb8bf4 to 8dbd7c1 Compare May 3, 2016 08:33
8000 @tmrts tmrts assigned iaguis May 3, 2016
@tmrts
Copy link
Contributor Author
tmrts commented May 3, 2016

Tests are merged PTAL

Refactors the if-else chains for readability

Fixes rkt#2421
@tmrts tmrts force-pushed the simplify/calculateDataDir branch from 8dbd7c1 to b8ee0d6 Compare May 11, 2016 08:45
@iaguis
Copy link
Member
iaguis commented May 12, 2016

LGTM

@iaguis iaguis merged commit 9d92951 into rkt:master May 12, 2016
@tmrts t 8945 mrts deleted the simplify/calculateDataDir branch May 12, 2016 09:17
@jonboulle
Copy link
Contributor

really

guys

really

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0