-
Notifications
You must be signed in to change notification settings - Fork 534
transport: make Endpoint an interface, fixes #362 #365
Conversation
smola
commented
Apr 27, 2017
- add internal *url.URL implementation for regular URLs.
- add internal implementation for SCP-like URLs.
plumbing/transport/common.go
Outdated
User() string | ||
// Password returns the password or an empty string if none is given. | ||
Password() string | ||
// User returns the user or an empty string if none is given. |
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.
copypasta typo.
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.
👍 done
plumbing/transport/common.go
Outdated
scpLikeUrlRegExp = regexp.MustCompile("^(?:(?P<user>[^@]+)@)?(?P<host>[^:]+):/?(?P<path>.+)$") | ||
) | ||
|
||
func parseSCPLike(endpoint string) Endpoint { |
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.
Returning (Endpoint, bool)
would be more idiomatic, so it can be used like:
path := "foo/bar"
if e, ok := parseSCPLike(path) ; ok {
return e, nil
}
// try other formats...
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.
👍 done
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.
After check @alcortesm comments, approved for me.
* add internal *url.URL implementation for regular URLs. * add internal implementation for SCP-like URLs.
Codecov Report
@@ Coverage Diff @@
## master #365 +/- ##
==========================================
- Coverage 77.28% 76.71% -0.57%
==========================================
Files 122 122
Lines 8518 8555 +37
==========================================
- Hits 6583 6563 -20
- Misses 1198 1268 +70
+ Partials 737 724 -13
Continue to review full report at Codecov.
|