Defer closing
This commit is contained in:
parent
dad789954f
commit
d93c7a6da7
11
main.go
11
main.go
@ -70,6 +70,9 @@ func main() {
|
||||
req.Header.Add("Content-Type", mwriter.FormDataContentType())
|
||||
|
||||
go func() {
|
||||
defer mwriter.Close()
|
||||
defer writer.Close()
|
||||
|
||||
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
@ -103,14 +106,6 @@ func main() {
|
||||
if err != nil {
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user