This repository was archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add verbose logging option to WriteDepTree #968
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0e9789b
Add verbose logging option to WriteDepTree
ebati 4bae486
Use discardLogger for non-verbose requests
ebati e1b4bb5
Fix tests with nil verbose logger
ebati 37e2e02
Use ctx.Err as verbose logger
ebati f4c0625
Fix missed out nil loggers
ebati bd86b7f
Add package list to string
ebati 72f9ec8
Add test for LockedPackage.String()
ebati ffb06a7
Remove extra logs
ebati e1188e0
Use ProjectIdentifier errString func to describe id
ebati 28bba15
Fix test names and s/for/with
ebati 2814cc0
Remove packages from WriteDepTree log message
ebati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,3 +128,54 @@ func TestLocksAreEq(t *testing.T) { | |
t.Error("should fail when individual lp were not eq") | ||
} | ||
} | ||
|
||
func TestLockedProjectsString(t *testing.T) { | ||
tt := []struct { | ||
name string | ||
lp LockedProject | ||
want string | ||
}{ | ||
{ | ||
name: "full info", | ||
lp: NewLockedProject(mkPI("github.com/sdboyer/gps"), NewVersion("v0.10.0"), []string{"gps"}), | ||
want: "github.com/sdboyer/[email protected] with packages: [gps]", | ||
}, | ||
{ | ||
name: "empty package list", | ||
lp: NewLockedProject(mkPI("github.com/sdboyer/gps"), NewVersion("v0.10.0"), []string{}), | ||
want: "github.com/sdboyer/[email protected] with packages: []", | ||
}, | ||
{ | ||
name: "nil package", | ||
lp: NewLockedProject(mkPI("github.com/sdboyer/gps"), NewVersion("v0.10.0"), nil), | ||
want: "github.com/sdboyer/[email protected] with packages: []", | ||
}, | ||
{ | ||
name: "with source", | ||
lp: NewLockedProject( | ||
ProjectIdentifier{ProjectRoot: "github.com/sdboyer/gps", Source: "github.com/another/repo"}, | ||
NewVersion("v0.10.0"), []string{"."}), | ||
want: "github.com/sdboyer/gps (from github.com/another/repo)@v0.10.0 with packages: [.]", | ||
}, | ||
{ | ||
name: "version pair", | ||
lp: NewLockedProject(mkPI("github.com/sdboyer/gps"), NewVersion("v0.10.0").Pair("278a227dfc3d595a33a77ff3f841fd8ca1bc8cd0"), []string{"gps"}), | ||
want: "github.com/sdboyer/[email protected] with packages: [gps]", | ||
}, | ||
{ | ||
name: "revision only", | ||
lp: NewLockedProject(mkPI("github.com/sdboyer/gps"), Revision("278a227dfc3d595a33a77ff3f841fd8ca1bc8cd0"), []string{"gps"}), | ||
want: "github.com/sdboyer/gps@278a227dfc3d595a33a77ff3f841fd8ca1bc8cd0 with packages: [gps]", | ||
}, | ||
} | ||
|
||
for _, tc := range tt { | ||
t.Run(tc.name, func(t *testing.T) { | ||
s := tc.lp.String() | ||
if tc.want != s { | ||
t.Fatalf("want %s, got %s", tc.want, s) | ||
} | ||
}) | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this has been extracted into a function, would you mind adding a small unit test for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sure