Commit Graph

145 Commits

Author SHA1 Message Date
David Hill d8f796af33 travis: test against go 1.11 2018-08-30 15:11:38 -04:00
David Hill 8991bc29aa travis: test against go 1.10.x 2018-02-21 17:26:28 -06:00
Roger Peppe 87df7c60d5 simpler, more robust bypass
We make the bypass implementation a little simpler
by inferring the flag field position from available
reflect information and more robust by checking
that the flags that are set actually match the
semantics we expect.

We can restrict the use of unsafe to a single function: flagField.
2018-02-03 01:28:59 -06:00
David Hill db69d09d2c vet: fix vet warnings 2018-01-21 11:36:22 -05:00
Kevin Burke ecdeabc654 Add Go tip to coverage matrix
Also make this project compatible with running Travis CI on
forks - the go_import_path directive tells Travis to clone to
$GOPATH/src/github.com/davecgh/go-spew even if the remote user is
different.
2017-10-05 10:54:31 -05:00
Dave Collins dce690a33e
Update tests for cgo changes to Go tip. 2017-10-03 14:58:30 -05:00
David Hill a476722483 travis: test against go 1.9 2017-08-29 15:53:20 -04:00
David Hill adab96458c travis: test against 1.8.x 2017-07-11 14:34:51 -04:00
David Hill 9fadf46324 travis: Use gometalinter 2017-07-11 11:24:36 -05:00
Fabio Rapposelli e250ec7f59 Fix 'and/or' in the ISC license text 2017-07-11 11:23:18 -05:00
Andrew Keating d0f88dafcf Fix build, license, coverage, and godoc links 2017-07-11 11:21:44 -05:00
wangkechun a174e30547 Update common.go (#63) 2017-07-11 11:20:43 -05:00
Bill Q 782f4967f2 correct misspell on spew/common.go#L183 2017-06-27 02:16:45 +03:00
Dave Collins 346938d642 Correct a copy of misspellings found by misspell. 2016-10-29 15:57:26 -05:00
Dave Collins be602f8312 Remove duplicate godoc badge. 2016-10-29 15:49:14 -05:00
Dave Collins eec25ffc18
Update badges in README.md to SVG.
Also, while here:

- Add a license badge
- Add godoc badge alongside other badges at the very top
- Add link to the copyfree website for the license
2016-10-29 15:48:26 -05:00
Dave Collins 8aeb47a9ec Update license copyright years.
Several files had been updated since the listed years.  This updates
them accordingly.
2016-10-29 15:38:27 -05:00
Dave Collins bae5ef75ff Update doc.go/README.md with new config options. 2016-10-29 15:03:44 -05:00
Alexander Staubo 04cdfd4297 Adds new config options:
DisablePointerAddresses: Specifies whether to disable the printing of
pointer addresses.

DisableCapacities specifies whether to disable the printing of capacities
for arrays, slices, maps and channels.

These are useful when diffing data structures in tests. Printing pointers
and capacities would otherwise lead to false negatives.
2016-10-28 13:58:48 -04:00
Dave Collins 6d212800a4 Deprecate "disableunsafe" tag in favor of "safe".
This adds a new build tag named "safe" which serves the exact same
purpose as the current "disableunsafe" tag.  This is being done, as
recommended by @shurcooL, since it is emerging as the standard way to do
it in several high profile packages, it mirrors the "unsafe" package
nicely, it is shorter, and users generally seem to prefer it.

However, to avoid breaking existing infrastructure, the disableunsafe
tag is still available and simply is being deprecated.
2016-09-07 12:06:01 -05:00
Jonathan Hall 66f99a29a0 Disable unsafe for GopherJS compiler.
* Disable unsafe for GopherJS compiler.
* Update comments to reflect GopherJS build constraints
2016-09-07 11:16:42 -05:00
anatoly techtonik 3838b6852d Link missing blog post to web archive (fixes #46 and #41) 2016-09-02 21:58:02 +03:00
David Hill 6cf5744a04 Update Travis to test multiple golang versions. 2016-08-16 12:40:47 -05:00
Waldir Pimenta f438166ffd Add license title. 2016-08-16 12:35:55 -05:00
Dave Collins 5215b55f46 Add logic to deal with reflect pkg changes on tip.
This commit adds logic to gracefully the internal reflect.Value flag bit
changes as of golang commit adf9b30e5594 while maintaining support all
the back to Go 1.0.

It accomplishes this by adding code to the init time inspection to
detect the change and set the flag positions accordingly.

While here, also removes a TODO comment since it was already done
previously.
2015-11-05 15:13:17 -06:00
Dave Collins 2df174808e Add support for limited mode without unsafe pkg.
This commit adds support for compiling spew without the unsafe package.
When compiled without the unsafe package, some of the more advanced
features such as invoking stringers on pointers from non-pointer
variables and unexported struct fields are not available.

By default, spew will be compiled in the limited mode for Google App
Engine since the unsafe package is not available there.  Additionally,
spew can be compiled without the unsafe package manually by specifying
the "disableunsafe" build tag.

Finally, a new package-level constant named "UnsafeDisabled" has been
exposed which can be used to programmatically determine if spew was
compiled with access to the unsafe package.
2015-06-19 15:29:34 -05:00
Jason Buberel f9f629a1d0 Provide an example on how to debug a web app.
Update README.md

Removing extra line.
2015-05-25 14:24:11 -07:00
Brian Dorsey a6eef0c3a9 Removed spurious "spew". 2015-05-17 16:54:58 -07:00
Brian Dorsey c15d848066 Add import line to README.md quickstart 2015-05-03 18:18:55 -07:00
Tim Hockin 3e6e67c4dc Enable methods to sort map keys and spew itself as last resort
If enabled by flags, try to use methods to stringify map keys and sort on that.

If we can't use primitive sorting and we can't use methods, we can still fall
back on spew itself.  If SpewKeys is enabled, use Sprintf("%#v") to generate a
string and sort by that.
2015-04-10 08:46:42 -07:00
Dave Collins fc32781af5 Add -u to the README installation instructions.
This will allow the command to update the package if an old one happens to
be present while still fetching it if it's missing.

Suggested by @shurcooL in #28.
2015-02-23 15:20:11 -06:00
Anaminus a4b53deb9b Add support for sorting keys that are arrays. 2015-02-23 15:16:52 -06:00
deads2k 1aaf839fb0 make nil maps appear different than empty maps 2015-01-19 11:34:19 -05:00
Dave Collins 83f84dc933 Improve unsafe reflect value handling.
This commit modifies the unsafeReflectValue function to recognize
reference types even when the indirection flag is not set for the series
of golang commits after ecccf07e7f9d and before 82f48826c6c7 which
introduced the additional scalar field in the reflect.Value struct.  That
additional field has since been removed, but the intention of this code is
to work properly across all Go versions and other packages make use of the
logic.

Thanks to @shurcooL for providing example code which wasn't working
properly with the function when it was exported and therefore being called
in ways which spew itself does not.
2014-11-15 20:01:10 -06:00
Dave Collins 128854244a Add logic to deal with reflect pkg changes on tip.
This commit adds logic to gracefully handle the new internal reflect.Value
structure on tip as of golang commit 82f48826c6c7 as well as the internal
reflect.Value flag bit changes as of golang commit 90a7c3c86944.

It accomplishes this by doing some inspection at init time and choosing
the appropriate offsets and flag positions accordingly.  There was some
previous logic which dealt with a similar issue for golang commit
ecccf07e7f9d.  However, since the more recent commits essentially reverted
the change and also modify the flag bit positions, it made more sense to
rework the detection logic.  In particular, the new logic examines the
size of the reflect.Value struct to determine the difference and extracts
the kind from the flags to determine if the flags have been changed.

As a result, this commit allows spew to work properly with tip all the
back to Go 1.0.
2014-10-24 18:49:38 -05:00
Josh Rickmar 3fdaf5cea8 Dump non-zero len and cap for applicable types.
Closes #16.
2014-05-05 22:39:05 -05:00
Dave Collins 9ed19f9b0c Point test coverage badge at master branch. 2014-03-27 05:31:30 -05:00
Dave Collins 96dfb77570 Configure TravisCI to test with testcgo tag. 2014-03-27 05:26:53 -05:00
Dave Collins 4451e342b3 Add coveralls.io test coverage badge. 2014-03-27 05:20:20 -05:00
Dave Collins 55afdd1e0d Don't change to spew dir before invoking goveralls. 2014-03-27 05:13:54 -05:00
Dave Collins 053ad9b77a Correct TravisCI .yml file. 2014-03-27 05:08:45 -05:00
Dave Collins 2d30de540a Configure TravisCI goveralls call correctly.
By default goveralls tries to use gocov.  This modifies it to use the
cover profile provided by go test instead.
2014-03-27 05:05:19 -05:00
Dave Collins 8ae4f2591e Setup TravisCI to report cov stats to coveralls.io. 2014-03-27 04:58:48 -05:00
Dave Collins 110c37a4d1 Update TravisCI to use Go 1.2.
Also fix a comment typo in doc.go under the custom formatter section.
2014-03-27 04:46:40 -05:00
Dave Collins 65ca732a33 Add logic to deal with reflect pkg changes on tip.
This commit adds logic to gracefully handle the new internal reflect.Value
structure on tip as of golang commit ecccf07e7f9d.  It accomplishes this
by doing some inspection at init time and choosing the appropriate offsets
as well as modifying which offset is used for the value accordingly.  As a
result, this allows spew to work properly with both the current release
version of Go as well as tip.

Fixes #15.
2014-01-08 02:01:15 -06:00
Dave Collins bde46cf02b Merge pull request #14 from pmezard/fix-sorting-test-on-32bits
tests: fix TestSortValues on 32-bits platforms
2013-12-02 00:50:11 -08:00
Patrick Mezard 264fa19def tests: fix TestSortValues on 32-bits platforms
reflect.DeepEqual fails when comparing reflect.Value containing float64. I
think it cannot make sense of reflect.Value pointer tricks and directly
compare reflect.Value.val fields which contain the float value in 64 bits,
but a pointer to the float in 32 bits.

Fortunately, interface{} which have a similar memory layout, compare correctly,
so we just turn the []reflect.Value into []interface{}.
2013-12-01 16:46:38 +01:00
Dave Collins e762b3d132 Make build status badge only apply to master branch. 2013-11-16 22:24:52 -06:00
Dave Collins 7b68a4a09a Add TravisCI build status badge to README.md. 2013-11-16 21:44:48 -06:00
Dave Collins 4d8bf045f7 Require Go 1.1 for TravisCI. 2013-11-16 21:33:05 -06:00