Skip to content

Commit

Permalink
Render internal flag in JSON output (resolves #13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Banks committed Feb 14, 2018
1 parent 17c8587 commit e7984a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 1.2.0
VERSION = 1.2.1

RELEASE_PKG = ./cmd/depth
INSTALL_PKG = $(RELEASE_PKG)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
...
Expand Down
7 changes: 7 additions & 0 deletions cmd/depth/depth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"-"`

Expand Down

0 comments on commit e7984a0

Please sign in to comment.