Skip to content

Conversation

@bmonkman
Copy link
Contributor

No description provided.

@bmonkman bmonkman requested review from davidcheung and dtoki June 17, 2020 22:55
mappedSources[mod.Name] = moduleSource
}
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
Contributor 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
Contributor 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
Contributor 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.

3 participants