Commit 84f92f76 authored by User expired's avatar User expired
Browse files

simple concurrency

parent 6ca1404c
......@@ -197,8 +197,12 @@ var pullAssignmentCmd = &cobra.Command{
stdIds := getStudentIDs(args[1])
ack := make(chan bool, len(stdIds))
for _,stdID := range stdIds {
stdGrpName := strings.Join([]string{viper.GetString("basegroup"), viper.GetString("semester"), args[1], stdID}, "/")
go func (arg string) {
stdGrpName := strings.Join([]string{viper.GetString("basegroup"), viper.GetString("semester"), args[1], arg}, "/")
sg := getGitlabGroup(gitl, stdGrpName)
projcts,_,prjErr := gitl.Groups.ListGroupProjects(sg.ID, nil)
......@@ -217,11 +221,11 @@ var pullAssignmentCmd = &cobra.Command{
}
if foundProj == false {
prjNFErr := errors.New("Assignment could not be found for student ID: ")
fmt.Println(prjNFErr, stdID)
fmt.Println(prjNFErr, arg)
os.Exit(1)
}
studentClonePath := strings.Join([]string{viper.GetString("checkoutPath"), viper.GetString("semester"), args[1], stdID, frkProj.Name}, "/")
studentClonePath := strings.Join([]string{viper.GetString("checkoutPath"), viper.GetString("semester"), args[1], arg, frkProj.Name}, "/")
dirErr := os.MkdirAll(studentClonePath, os.ModePerm)
if dirErr != nil {
log.Fatal(dirErr)
......@@ -267,6 +271,12 @@ var pullAssignmentCmd = &cobra.Command{
}
fmt.Println(commit)
ack <- true
}(stdID)
}
for i:= 0; i < len(stdIds); i++ {
<-ack
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment