Skip to content
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

ZER0155 update repo init to detect owner type #162

Merged
merged 3 commits into from Jun 12, 2020

Conversation

cjhawkins
Copy link
Contributor

No description provided.

@cjhawkins cjhawkins requested a review from bmonkman June 12, 2020 20:57
// takes a list of subdirectories containing modules to create a repository and do initial commit for
func InitializeRepositories(moduleDirs []string, remoteRepository string, organizationName string, githubApiKey string) {
ownerName, repositoryName, pErr := parseRepositoryUrl(repositoryUrl)
if pErr != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to not just have err and reuse it?

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 like to keep errors scoped as close to the call as possible, but its not really needed here. I can change this to reuse a single err.

remoteOrigin := fmt.Sprintf("%s/%s.git", remoteRepository, moduleDir)
commands := []InitialCommands{
remoteOrigin := fmt.Sprintf("git@github.com:%s/%s.git", ownerName, repositoryName)
fmt.Printf("remote origin: %s\n", remoteOrigin)
Copy link
Member

Choose a reason for hiding this comment

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

Probably not necessary to print

Copy link
Member

Choose a reason for hiding this comment

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

Actually I think all the status prints in this probably aren't very useful to the user. Just one per repo saying we are creating a repo should be enough.

ownerName := segments[1]
repositoryName := segments[2]

fmt.Printf("found owner %s, repository %s\n", ownerName, repositoryName)
Copy link
Member

Choose a reason for hiding this comment

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

not necessary to print

return err
}

fmt.Printf("Repository successfully created for module: %s\n", repositoryName)
Copy link
Member

Choose a reason for hiding this comment

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

Just the above print should be enough

Copy link
Member

@bmonkman bmonkman left a comment

Choose a reason for hiding this comment

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

Looks good after removing some of those print statements.
Thanks!

@cjhawkins cjhawkins merged commit bec2700 into master Jun 12, 2020
@cjhawkins cjhawkins deleted the ZERO155-detect-github-owner-type branch June 12, 2020 22:45
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.

None yet

2 participants