Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

SafeWriter.Write noExamples->examples #707

Merged
merged 1 commit into from
Jun 2, 2017
Merged

SafeWriter.Write noExamples->examples #707

merged 1 commit into from
Jun 2, 2017

Conversation

jmank88
Copy link
Collaborator

@jmank88 jmank88 commented Jun 2, 2017

#672
This PR proposes inverting a bool method parameter:

func (sw *SafeWriter) Write(root string, sm gps.SourceManager, noExamples bool) error 

func (sw *SafeWriter) Write(root string, sm gps.SourceManager, examples bool) error 

I see that using a negative makes sense for the command line flag (no-examples), but I don't see a compelling reason to propagate that into the library code where it seems unidiomatic and a default/zero value is not relevant.

@sdboyer
Copy link
Member

sdboyer commented Jun 2, 2017

Ah yes, good call. As a rule, the negation in the variable always makes it harder to reason about, as the reader's mind has to perform e.g. a double negation instead of one.

@sdboyer sdboyer merged commit 29acc63 into golang:master Jun 2, 2017
@jmank88 jmank88 deleted the safe_writer_examples branch June 7, 2017 23:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants