Files
mostlymatter/app
Jesse Hallam 74533371b2 MM-18115: fix segment v3 usage (#12317)
* diagnostics_test.go: fix spacing

* diagnostics_test.go: explicitly assert payload

This fails, since the package is currently receiving struct pointers and won't set the MessageId or Timestamp on the corresponding Message.

* MM-18115: fix segment v3 usage

In v5.14, we updated [github.com/segmentio/analytics-go](https://github.com/segmentio/analytics-go) to v3 as part of https://mattermost.atlassian.net/browse/MM-12389. As noted in the [migration guide](https://segment.com/docs/sources/server/go/#migrating-from-v2), the API subtly changed to expect a struct value and not a struct pointer:

```go
// in v2, you would call the `Track` method with a `Track` struct.
client.Track(&track)

// in v3, you would call the `Enqueue` method with a `Track` struct.
// Note that a pointer is not used here.
client.Enqueue(track)
```

Unfortunately, we kept passing a pointer, and the package didn't complain since it only required an interface -- which the pointer to these structs still implemented. Internally, it only checked for the value types, and failed to annotate our payloads with the requisite metadata. Upstream, segment.io accepted the payload, but then discarded it silently.

This has since been reported and fixed in https://github.com/segmentio/analytics-go/pull/146, but isn't yet part of a tagged release of the package.

Fix our code to pass struct values instead.

Fixes: MM-18115
2019-09-26 23:49:43 -03:00
..
2019-07-22 22:13:39 +02:00
2018-03-07 12:36:40 -06:00
2019-07-22 22:13:39 +02:00
2019-03-06 15:06:45 -05:00
2019-07-22 22:13:39 +02:00