cupcake/raven-go — pull request #14 by tylrtrmbl (2013-12-30 21:02:00+00:00)
Title: Implement passing variadic attribtues

#### Whoops I was wrong before!

[Here](https://github.com/cupcake/raven-go/pull/10#issuecomment-31328503) to be specific, where I say:

> there's a precedent out there right now from the other clients that captureMessage and captureException function sort of like "just capture a message" and "just capture an exception" (or error, in our case). There's usually a capture method that gets all the bells and whistles instead.

While I thought I'd gone over the spec with a fine tooth comb, I'd misinterpreted the signatures for `captureMessage` and `captureException`. The examples always give tags, but it __doesn't__ mean that you give it optional tags. It does mean optional attributes, exactly like you implemented them @titanous.

Well, almost. _Every_ attribute should be specifiable in a variadic. Read this section of the spec I've quoted multiple times, _very carefully_, especially the code, to see what I mean:

> Additionally, you should provide methods (depending on the platform) which allow for capturing of a basic message and an exception-type:
>
> ```
> RavenClient::captureMessage(string $message)
> RavenClient::captureException(exception $exception)
> ```
>
> The above methods should also allow optional __arguments__ (or a map of arguments). For example:
>
> ```
> client.captureException(myException, {
> 'tags': {'foo': 'bar'},
> })
> ```
>
> If your platform supports block statements, it is recommend you provide something like the following:
>
> ```
> with client.captureExceptions(tags={'foo': 'bar'}):
> # do something that will cause an error
> 1 / 0
> ```

Note that it doesn't say anything about tags: it specifies attribute, and the attribute in the example was tags. So, every kind of attribute should be specifiable in a variadic. Looking over the python client again, this is how it does it too. __This PR implements that.__

#### It's smaller than it looks

My changes basically include:

- Adding some documentation
- Change the tag implementation as started in cupcake/raven-go#13
- Adding types that allow simple values to be passed as variadic arguments and mapped to fields in the packet struct, along with the code that enables this. As casualties of this:
- `Packet` becomes private, since it is now possible to specify everything about them from the `Capture`* methods. This matches the other client implementations nicely!
- Packets are dispensed fully initialized from the client, which allows Client attributes to be merged with with the specified message and attributes, and any unset required fields (or the culprit) be automatically specified.
- All client/context/capture attribute merging is now explicit via the `MergeAttributes` method on `packet`.
- Many examples in example.go - which is a little sloppy but it's how I'm testing now. We can make this different after tests.

#### What's left in this PR?

__TESTS TESTS TESSSTTTTSSSS!__

I'm currently having fun rewriting the tests so that:

- It works with the new architecture
- It works for fork developers: I keep getting failing tests because I am not "cupcake".

Hopefully done by the end of today.

#### Much Appreciated

This is a ton of code, and a lot of changes, but we finally become on spec for realsies. Thanks for looking over my bomb, @titanous!