Remove goroutine
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 1m39s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 1m39s
This commit is contained in:
parent
2f3c0ee4e2
commit
cea450bbbb
81
main.go
81
main.go
@ -65,56 +65,47 @@ func main() {
|
||||
githubactions.Fatalf("Unable to create request: %v", err.Error())
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer writer.Close()
|
||||
|
||||
mwriter := multipart.NewWriter(writer)
|
||||
req.Header.Add("Content-Type", mwriter.FormDataContentType())
|
||||
|
||||
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
||||
githubactions.Infof("Reading %v", innerPath)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
relativeParh := strings.TrimPrefix(innerPath, path)
|
||||
|
||||
in, err := os.Open(innerPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer in.Close()
|
||||
|
||||
pathInfo, err := in.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pathInfo.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
mwriter := multipart.NewWriter(writer)
|
||||
req.Header.Add("Content-Type", mwriter.FormDataContentType())
|
||||
|
||||
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
||||
githubactions.Infof("Reading %v", innerPath)
|
||||
if info.IsDir() {
|
||||
githubactions.Infof("Skipping directory %v", innerPath)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
githubactions.Fatalf("Unable to create request body : %v", fmt.Errorf("%w", err))
|
||||
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)
|
||||
}
|
||||
|
||||
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")
|
||||
client := &http.Client{}
|
||||
|
Loading…
Reference in New Issue
Block a user