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

rewrote save function #2

Merged
merged 2 commits into from
Feb 14, 2017
Merged

rewrote save function #2

merged 2 commits into from
Feb 14, 2017

Conversation

tscholl2
Copy link
Contributor

No description provided.

}
return ioutil.WriteFile(filename, b, 0644)
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
Copy link

Choose a reason for hiding this comment

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

removing this line will get good performance.

jsonstore.go Outdated
toSave := make(map[string]string)
for key := range ks.Data {
toSave[key] = string(ks.Data[key])
}
b, err := json.MarshalIndent(toSave, "", " ")
var w io.Writer
f, err := os.OpenFile(filename, os.O_RDWR, 0644)
Copy link

Choose a reason for hiding this comment

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

f, err := os.Create(filename)

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 totally forgot about new files! Thanks for finding that. I'll fix it and resubmit soon~ish

@schollz schollz merged commit 813bcb3 into schollz:master Feb 14, 2017
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.

3 participants