Re-add goroutine
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 56s

This commit is contained in:
Alexandre Bruyant 2024-01-06 21:49:47 +01:00
parent cea450bbbb
commit ecd319f629

17
main.go
View File

@ -68,30 +68,30 @@ func main() {
mwriter := multipart.NewWriter(writer)
req.Header.Add("Content-Type", mwriter.FormDataContentType())
go func() {
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
githubactions.Infof("Reading %v", innerPath)
if err != nil {
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
}
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)
}
@ -106,6 +106,7 @@ func main() {
if err != nil {
githubactions.Fatalf("Unable to create request body : %v", fmt.Errorf("%w", err))
}
}()
githubactions.Infof("Calling node API")
client := &http.Client{}