Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kasparasg
Copy link
Contributor

@kasparasg kasparasg commented Jun 7, 2019

Hey πŸ‘‹

This PR is related to #92.

I understand that the way I implemented, introduces a breaking change, since you now have to specify the host, e.g. github.com. But maybe that's ok?

Alternatively, perhaps it could be implemented as a separate driver (github-ee://) that uses the github driver as core.

Would like to get some thoughts on this? 😊

@coveralls
Copy link

coveralls commented Jun 7, 2019

Pull Request Test Coverage Report for Build 427

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 51.626%

Totals Coverage Status
Change from base Build 422: 0.0%
Covered Lines: 778
Relevant Lines: 1507

πŸ’› - Coveralls

@dhui dhui mentioned this pull request Jun 7, 2019
Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@kasparasg kasparasg force-pushed the gh-enterprise-support branch from b79f770 to ce348f1 Compare June 11, 2019 10:43
@kasparasg
Copy link
Contributor Author

@dhui Let me know what you think 🀞 Had to export Github struct fields and ReadDirectory() method, so I can embed and reuse in github_ee package.

@kasparasg kasparasg force-pushed the gh-enterprise-support branch from 979568f to 0a8a416 Compare June 13, 2019 13:29
migrations *source.Migrations
}

type Config struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Github struct fields are now unexported, I've used Config struct as a way to pass paths and things to the Github driver. WithInstance() method sets the values from config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant to me. Doesn't the github.Client already contain all of this information?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow? πŸ€” I'm using Config struct, to set pathOwner, pathRepo and path on the github migration source driver. WithInstance() takes Config, so I thought, this was a good way to do that without need to export the fields. github.Client doesn't contain this info.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, you're right! I confused our Github driver w/ the underlying one...

I'd rather not have fields duplicated. So let's move the pathOwner, pathRepo, path, and ref fields from the Github struct to the Config struct, export them, and add a config *Config field to the Github struct. I think we should leave options unexported to avoid any conflicting sources of truth.

Also, we'll need to properly initialize any pointers so they're not nil. It may make sense to do this in an unexported method (like ensureFields()) and run that before each relevant method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! I should have noticed this in the last review...

Let's drop the URL field (since it's not being used) and rename PathOwner and PathRepo to Owner and Repo respectively, since the path prefixes don't make sense anymore...
https://godoc.org/github.com/google/go-github/github#RepositoriesService.GetContents

migrations *source.Migrations
}

type Config struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant to me. Doesn't the github.Client already contain all of this information?

}

g := &GithubEE{}
_, err = g.Open("github-ee://foo:bar@" + u.Host + "/mattes/migrate_test_tmp/test?skipSSLVerify=true#452b8003e7")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get the response and check that the status code is http.StatusOK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open() returns Driver and error types, so there isn't really a way to check for http.StatusOK. If err is null, the migrations then run, but that's tested in the github source driver. Unless I misunderstood the suggestion?

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating the feedback! We're almost there!

migrations *source.Migrations
}

type Config struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, you're right! I confused our Github driver w/ the underlying one...

I'd rather not have fields duplicated. So let's move the pathOwner, pathRepo, path, and ref fields from the Github struct to the Config struct, export them, and add a config *Config field to the Github struct. I think we should leave options unexported to avoid any conflicting sources of truth.

Also, we'll need to properly initialize any pointers so they're not nil. It may make sense to do this in an unexported method (like ensureFields()) and run that before each relevant method.

@kasparasg
Copy link
Contributor Author

@dhui thanks for your feedback man. I think I addressed them 🀞

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the last one! We only have minor struct field renames and removals.

migrations *source.Migrations
}

type Config struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! I should have noticed this in the last review...

Let's drop the URL field (since it's not being used) and rename PathOwner and PathRepo to Owner and Repo respectively, since the path prefixes don't make sense anymore...
https://godoc.org/github.com/google/go-github/github#RepositoriesService.GetContents

@kasparasg
Copy link
Contributor Author

@dhui Config{} changes addressed πŸ˜‰

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR and for seeing it all the way through!

@dhui dhui merged commit 7c76166 into golang-migrate:master Jun 16, 2019
@kasparasg
Copy link
Contributor Author

@dhui no worries πŸ‘Thanks for your feedback! πŸ€“

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants