Remove goroutine
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 1m39s

This commit is contained in:
Alexandre Bruyant 2024-01-06 21:36:09 +01:00
parent 2f3c0ee4e2
commit cea450bbbb

17
main.go
View File

@ -65,14 +65,15 @@ func main() {
githubactions.Fatalf("Unable to create request: %v", err.Error()) githubactions.Fatalf("Unable to create request: %v", err.Error())
} }
go func() {
defer writer.Close()
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 { err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
githubactions.Infof("Reading %v", innerPath) githubactions.Infof("Reading %v", innerPath)
if info.IsDir() {
githubactions.Infof("Skipping directory %v", innerPath)
return nil
}
if err != nil { if err != nil {
return err return err
@ -86,15 +87,6 @@ func main() {
} }
defer in.Close() defer in.Close()
pathInfo, err := in.Stat()
if err != nil {
return err
}
if pathInfo.IsDir() {
return nil
}
w, err := mwriter.CreateFormFile("file", relativeParh) w, err := mwriter.CreateFormFile("file", relativeParh)
if err != nil { if err != nil {
return err return err
@ -114,7 +106,6 @@ func main() {
if err != nil { if err != nil {
githubactions.Fatalf("Unable to create request body : %v", fmt.Errorf("%w", err)) 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{}