Skip to content

change default extension of configuration file to json#92

Merged
kytrinyx merged 11 commits intoexercism:masterfrom
lcowell:json-extension
Aug 13, 2014
Merged

change default extension of configuration file to json#92
kytrinyx merged 11 commits intoexercism:masterfrom
lcowell:json-extension

Conversation

@lcowell
Copy link
Contributor

@lcowell lcowell commented Aug 11, 2014

  • renames configuration file when calling ToFile and FromFile
  • does nothing if user passes a -c option to the cli
  • does nothing if it would clobber a user's files
  • notifies user once change is made

I'm new to go and contributing because I want practice and want to learn. Feedback is welcome.

This should resolve issue #39

@lcowell
Copy link
Contributor Author

lcowell commented Aug 11, 2014

The Travis build failure appears to be an issue with go vet not being available.

$ go vet ./...
go tool: no such tool "vet"; to install:

@kytrinyx
Copy link
Member

D'oh. I added that this morning, and then we had a critical issue at work and I haven't had a chance to check it. Let me remove that for now.

I need to look at this tomorrow morning—so fried right now.

Thanks for working on this!

config/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Per the golang style guide, all exported functions should be commented (see the style of the other exported comments in this package). For now I've only been trying to clean up the config package–main has larger issues than style at the moment.

http://golang.org/doc/effective_go.html#commentary

@kytrinyx
Copy link
Member

This looks good overall. I'm slowly trying to refactor my way to a cleaner design in this thing, so all the style comments are mostly just a conversation starter about where I want to go eventually.

I've been running golint on the config package:

$ golint config/*go

It might sometimes complain about things that aren't really problems, but for the most part it really helps clean up some basic go idiom things.

config/config.go Outdated
Copy link
Member

Choose a reason for hiding this comment

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

If this is used outside the package, then I would name it Normalize() (because then it would be called with config.NormalizeConfig() and there's a stutter). Here, since it's only used inside the package I wouldn't export it, and I would name it normalizeFilename.

@lcowell
Copy link
Contributor Author

lcowell commented Aug 12, 2014

Thanks for taking the time to put this feedback together. I've implemented most of your suggestions. BTW should I be rebasing or merging cli/master in to this feature branch ?

@kytrinyx
Copy link
Member

Yeah, go ahead and rebase this onto master.

This looks good. I can change the bit around messaging the user after it's merged in to master.

@lcowell
Copy link
Contributor Author

lcowell commented Aug 13, 2014

Sorry, silly question, but do you mean for me to call git rebase master from my json-extension branch once I've update my master to be in sync with yours ?

@kytrinyx
Copy link
Member

Yeah, there are a few ways you could do this:

  1. Rebase by pulling with rebase from the upstream master:
# assuming you are on json-extension
git pull --rebase upstream master
  1. Fetch the remote and rebase onto the tag for the upstream master:
# assuming you are on json-extension
git fetch upstream && git rebase upstream/master
  1. Update your master then rebase onto it:
git checkout master
git pull upstream master # assuming you have not changed your master
git checkout json-extension
git rebase master

@lcowell
Copy link
Contributor Author

lcowell commented Aug 13, 2014

Thanks for the explanation, I definitely learned something from that. After performing this I'm getting branches diverged status. I can easily undo this operation (thanks reflog!).

/G/s/g/e/cli (json-extension) $ git pull --rebase upstream master
<snip>
~/G/s/g/e/cli (json-extension) $ git status
On branch json-extension
Your branch and 'origin/json-extension' have diverged,
and have 13 and 11 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

I can pull, but then I get a merge commit.
json-extension will already merge cleanly in to master already, so does it makes sense to just merge it in ? What would you do here ? Thanks!

@kytrinyx
Copy link
Member

Branches diverged is normal in this scenario (sorry, I should have mentioned that), and the fix is to push with --force:

git push --force origin json-extension

That will put whatever is on your local branch up on the remote branch, and it automatically updates the pull request.

@kytrinyx
Copy link
Member

I should probably mention that pushing with --force is a terrible idea on master, and on any branch where you're collaborating with someone. For pull requests it's a common scenario, though, so you'll end up seeing it more often in github-specific open source projects.

lcowell added 11 commits August 13, 2014 10:10
This allows us to determine if the user has supplied a configuration
path or not. The cli package fills in a default value so we would not
know whether the returned path is coming from the cli package defaults
or the user.
No error means the file is present. An error other than a file missing
should be returned. I'm not sure if there's a simpler way to accomplish
this but my head !Nothurts(isHurtError).
@lcowell
Copy link
Contributor Author

lcowell commented Aug 13, 2014

Excellent! Thanks for your help! I did a push --force, so unless you see something else, I don't think there's any more to do on this pull request.

@kytrinyx
Copy link
Member

This looks great, thank you!

kytrinyx added a commit that referenced this pull request Aug 13, 2014
change default extension of configuration file to json
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

Successfully merging this pull request may close these issues.

2 participants