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

Add create command #167

Merged
merged 5 commits into from Jun 18, 2020
Merged

Add create command #167

merged 5 commits into from Jun 18, 2020

Conversation

bmonkman
Copy link
Member

No description provided.

}
return modules
return modules, mappedSources
Copy link
Contributor

Choose a reason for hiding this comment

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

is it bad to just add source to the moduleConfig itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

ModuleConfig represents the structure of the module file, so we don't want it in there.

wg := sync.WaitGroup{}
wg.Add(len(projectConfig.Modules))
for _, mod := range projectConfig.Modules {
go module.FetchModule(mod.Files.Source, &wg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Trying to understand how the go-getter stuff works
this will not download again if it's already on local? for Get() on their docs they say

"If dst already exists, Get will attempt to update it."

and the isLocal function always receives the remote-source only, to do the getter.Detect, is getter.Get where the magic happens?

localPath := GetSourceDir(source)
if !isLocal(source) {
err := getter.Get(localPath, source)
if err != nil {
exit.Fatal("Failed to fetch remote module from %s: %v\n", source, err)
}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah right now it may fetch it again, but so far it's fast enough that it hasn't been a problem. I want to go over this stuff again at some point anyway to have these temporary files in a global location rather than written to a local tmp directory. At that point we can put more thought into if/how we want to cache these files.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I see, was just trying to figure out what it does

Copy link
Member Author

Choose a reason for hiding this comment

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

Also the source location you provide can be local, not just remote, which is why we have that isLocal check there.

@bmonkman bmonkman merged commit 26965aa into master Jun 18, 2020
@bmonkman bmonkman deleted the add-create-command branch June 18, 2020 18:52
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