According to the documentation:
// WriteHeader sends an HTTP response header with status code.
// If WriteHeader is not called explicitly, the first call to Write
// will trigger an implicit WriteHeader(http.StatusOK).
// Thus explicit calls to WriteHeader are mainly used to
// send error codes.
and
// Header returns the header map that will be sent by WriteHeader.
// Changing the header after a call to WriteHeader (or Write) has
// no effect.
so calling `w.Header().Set(contentType, jsonContentType)` after calling
`w.WriteHeader` does not set the content type -- the call can be removed
though as it always set `http.StatusOK` which will be done anyways
- Provide better examples in the examples subdirectory.
- Make the comments consistent in terms of using multi-line format for future-proofing.
- Extract major constants out.
- Added normal and exponential distributions to one of the examples.
- Improved the naming of a couple of local variables.
- Handled an error in the AccumulatingBucket ValueForIndex function whereby
the vestigal old behavior was accidentally preserved and not updated.
This could have been caught had the tests been updated first.
- Simplify Histogram prospectiveIndexForPercentile such that various
small tasks it performs are extracted into separate functions for easier
testing and code comprehension.
- Remedy a regression in Histogram prospectiveIndexForPercentile whereby
the prospective index may have included the terminating element of a
bucket.
- Provide help for Histogram prospectiveIndexForPercentile such that requesting
the terminating element of a bucket will fast-forward to the first element of
the next non-empty bucket.
- Fix TallingBucket's boundary constant, because they were originally keyed toward
percentages [0, 100], not decimal-based ones. The antique tests had been
temporarily commented out, which prevented this regression from being exposed.