-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: use go-git
#1709
Comments
👍 |
@azeemshaikh38 -- What would you say is the primary motivation for Is it:
Are you thinking something like this? // git/clients.go
type Git interface{
ListFiles()
GetFileContent()
ListCommits()
Search()
}
// git/gitlab.go
type Gitlab struct { ... }
// git/local.go
type Local struct { ... }
// git/github.go
type Github struct {
http.RoundTripper
}
func NewGithub(rt *http.RoundTripper) *Github {
return (go-github).github.NewClient(&http.Client{Transport: rt})
}
func (gh *Github) ListFiles() error {
// go-github implementation of ListFiles()
} Suggested in #1491 (comment):
|
Not really
The implementations can choose to use these if they prefer, but its not enforced at the code-level. |
no concerns on my side, looks like a good idea, so long it's well maintained (both seem to be the case) |
@azeemshaikh38 -- Okay, cool! We're saying the same thing, modulo impl details like file locations. Organizationally, what you have is better i.e., The only thing I'd nit about keeping from is: type Git interface{ ... }
I'd call this part of the scorecard API work: #1683 |
Could you expand on that? What's the usecase for making this an interface? Note that there is no caller which passes Did you mean something like this?
|
@azeemshaikh38 -- Just as an example, consider functional options: type Git interface{ ... }
type Option func(*Git)
type WithTransport(rt http.RoundTripper) Option {
return func(g *Git) {
g.rt = rt
}
}
type Github struct{ ... }
func NewGithub(...Option) { ... }
func main() {
rt := roundtripper.New()
gh := NewGithub(
WithTransport(rt),
)
// Do GitHub stuff
} ^^ in the above, any type that satisfies the Concrete example:
|
I kind of see what you are driving at. Let me start coding this up, it'll probably help me untangle this. |
This issue is stale because it has been open for 60 days with no activity. |
Proposing that we use
go-git
for poweringRepoClient
APIs that require git-like features. Some advantages I see of using this:ListFiles
,GetFileContent
,ListCommits
andSearch
that can be used across any Git-like system (GitHub, GitLab or even local git repos).--commit=v4.1.0
)Considering to start work on this (not a top priority for me, will work on it on the side). Just wanted to run it by folks to make sure no one has concerns. @laurentsimon @naveensrinivasan @justaugustus
The text was updated successfully, but these errors were encountered: