From e7984a0f3491957265d9e81a72be5e902441f548 Mon Sep 17 00:00:00 2001 From: Kyle Banks Date: Wed, 14 Feb 2018 09:06:07 -0500 Subject: [PATCH] Render internal flag in JSON output (resolves #13) --- Makefile | 2 +- README.md | 3 +++ cmd/depth/depth_test.go | 7 +++++++ pkg.go | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b9458bd..acd35bb 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 1.2.0 +VERSION = 1.2.1 RELEASE_PKG = ./cmd/depth INSTALL_PKG = $(RELEASE_PKG) diff --git a/README.md b/README.md index 08ed68f..0de954f 100644 --- a/README.md +++ b/README.md @@ -171,14 +171,17 @@ $ depth -json github.com/KyleBanks/depth/cmd/depth "deps": [ { "name": "encoding/json", + "internal": true, "deps": null }, ... { "name": "github.com/KyleBanks/depth", + "internal": false, "deps": [ { "name": "go/build", + "internal": true, "deps": null }, ... diff --git a/cmd/depth/depth_test.go b/cmd/depth/depth_test.go index 3863380..23c31ce 100644 --- a/cmd/depth/depth_test.go +++ b/cmd/depth/depth_test.go @@ -122,36 +122,43 @@ func Example_handlePkgsJson() { // Output: // { // "name": "strings", + // "internal": true, // "resolved": true, // "deps": [ // { // "name": "errors", + // "internal": true, // "resolved": true, // "deps": null // }, // { // "name": "internal/cpu", + // "internal": true, // "resolved": true, // "deps": null // }, // { // "name": "io", + // "internal": true, // "resolved": true, // "deps": null // }, // { // "name": "unicode", + // "internal": true, // "resolved": true, // "deps": null // }, // { // "name": "unicode/utf8", + // "internal": true, // "resolved": true, // "deps": null // } // ] // } } + func Example_handlePkgsExplain() { var t depth.Tree diff --git a/pkg.go b/pkg.go index b28ef94..1d54d71 100644 --- a/pkg.go +++ b/pkg.go @@ -13,7 +13,7 @@ type Pkg struct { Name string `json:"name"` SrcDir string `json:"-"` - Internal bool `json:"-"` + Internal bool `json:"internal"` Resolved bool `json:"resolved"` Test bool `json:"-"`