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

Client: Write() shouldn't allow a write without a single parameter #1679

Closed
d2g opened this issue Feb 22, 2015 · 2 comments
Closed

Client: Write() shouldn't allow a write without a single parameter #1679

d2g opened this issue Feb 22, 2015 · 2 comments

Comments

@d2g
Copy link

d2g commented Feb 22, 2015

Currently you can call the write function on the client without any parameters.
i.e.
c, err := client.NewClient(config)
if err != nil {
t.Fatalf("unexpected error. expected %v, actual %v", nil, err)
}

_, err = c.Write()
if err == nil {
    t.Fatalf("unexpected error.  expected %v, actual %v", nil, err)
}

will not error

I can' think of an instance where you would want to allow zero writes.

Can I suggest the function is changed to:
func (c _Client) Write(w Write, ws ...Write) (_Results, error)

@corylanou
Copy link
Contributor

I think the signature is fine, but we should check for len(writes) > 0 and if not, throw an error.

@beckettsean beckettsean added this to the Next Point Release milestone Apr 20, 2015
@beckettsean beckettsean modified the milestones: Next Point Release, Longer term Aug 6, 2015
@jsternberg
Copy link
Contributor

It looks like this was fixed in #1868. I'm closing this since it doesn't seem to be relevant anymore. Please reopen if this is still an issue. Thanks.

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

Successfully merging a pull request may close this issue.

4 participants