Re-add goroutine
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 56s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 56s
This commit is contained in:
parent
cea450bbbb
commit
ecd319f629
69
main.go
69
main.go
@ -68,44 +68,45 @@ func main() {
|
|||||||
mwriter := multipart.NewWriter(writer)
|
mwriter := multipart.NewWriter(writer)
|
||||||
req.Header.Add("Content-Type", mwriter.FormDataContentType())
|
req.Header.Add("Content-Type", mwriter.FormDataContentType())
|
||||||
|
|
||||||
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
go func() {
|
||||||
githubactions.Infof("Reading %v", innerPath)
|
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
||||||
if info.IsDir() {
|
if err != nil {
|
||||||
githubactions.Infof("Skipping directory %v", innerPath)
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.IsDir() {
|
||||||
|
githubactions.Infof("Skipping directory %v", innerPath)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
relativeParh := strings.TrimPrefix(innerPath, path)
|
||||||
|
githubactions.Infof("Reading %v", relativeParh)
|
||||||
|
w, err := mwriter.CreateFormFile("file", relativeParh)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
in, err := os.Open(innerPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
|
||||||
|
if written, err := io.Copy(w, in); err != nil {
|
||||||
|
return fmt.Errorf("error copying %s (%d bytes written): %v", relativeParh, written, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := mwriter.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
githubactions.Fatalf("Unable to create request body : %v", fmt.Errorf("%w", err))
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
relativeParh := strings.TrimPrefix(innerPath, path)
|
|
||||||
|
|
||||||
in, err := os.Open(innerPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer in.Close()
|
|
||||||
|
|
||||||
w, err := mwriter.CreateFormFile("file", relativeParh)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if written, err := io.Copy(w, in); err != nil {
|
|
||||||
return fmt.Errorf("error copying %s (%d bytes written): %v", relativeParh, written, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mwriter.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
githubactions.Fatalf("Unable to create request body : %v", fmt.Errorf("%w", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
githubactions.Infof("Calling node API")
|
githubactions.Infof("Calling node API")
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
|
Loading…
Reference in New Issue
Block a user