Compare commits

..

2 Commits

Author SHA1 Message Date
6588bd2d45 Remove sleep
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s
2024-01-06 22:17:41 +01:00
d93c7a6da7 Defer closing 2024-01-06 22:17:31 +01:00

14
main.go
View File

@ -10,7 +10,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time"
"github.com/sethvargo/go-githubactions" "github.com/sethvargo/go-githubactions"
) )
@ -70,6 +69,9 @@ func main() {
req.Header.Add("Content-Type", mwriter.FormDataContentType()) req.Header.Add("Content-Type", mwriter.FormDataContentType())
go func() { go func() {
defer mwriter.Close()
defer writer.Close()
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 {
if err != nil { if err != nil {
return err return err
@ -103,18 +105,8 @@ 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))
} }
if err := mwriter.Close(); err != nil {
githubactions.Fatalf("Unable to close multipart writer: %v", fmt.Errorf("%w", err))
}
if err := writer.Close(); err != nil {
githubactions.Fatalf("Unable to close writer: %v", fmt.Errorf("%w", err))
}
}() }()
time.Sleep(10 * time.Second)
githubactions.Infof("Calling node API") githubactions.Infof("Calling node API")
client := &http.Client{} client := &http.Client{}
res, err := client.Do(req) res, err := client.Do(req)