style: fix lint errors
All checks were successful
Format and Lint / format-check (push) Successful in 2m41s
Format and Lint / test (push) Successful in 2m40s

This commit is contained in:
Максим Слипенко 2024-12-26 17:03:01 +03:00
parent eb0483734e
commit a433b4fc7a

View file

@ -36,13 +36,13 @@ func createMultipartFileHeader(filePath string) *multipart.FileHeader {
formWriter := multipart.NewWriter(buffWriter) formWriter := multipart.NewWriter(buffWriter)
formPart, err := formWriter.CreateFormFile("file", filepath.Base(file.Name())) formPart, err := formWriter.CreateFormFile("file", filepath.Base(file.Name()))
if err != nil { if err != nil {
log.Fatal(err) log.Println(err)
return nil return nil
} }
// copy the content of the file to the form's file field // copy the content of the file to the form's file field
if _, err := io.Copy(formPart, file); err != nil { if _, err := io.Copy(formPart, file); err != nil {
log.Fatal(err) log.Println(err)
return nil return nil
} }
@ -57,14 +57,14 @@ func createMultipartFileHeader(filePath string) *multipart.FileHeader {
// read the form components with max stored memory of 1MB // read the form components with max stored memory of 1MB
multipartForm, err := formReader.ReadForm(1 << 20) multipartForm, err := formReader.ReadForm(1 << 20)
if err != nil { if err != nil {
log.Fatal(err) log.Println(err)
return nil return nil
} }
// return the multipart file header // return the multipart file header
files, exists := multipartForm.File["file"] files, exists := multipartForm.File["file"]
if !exists || len(files) == 0 { if !exists || len(files) == 0 {
log.Fatal("multipart file not exists") log.Println("multipart file not exists")
return nil return nil
} }
@ -126,9 +126,3 @@ func TestTaskService_Upload(t *testing.T) {
assert.Len(t, rpmFiles, 1) assert.Len(t, rpmFiles, 1)
assert.Equal(t, fileName, rpmFiles[0].Filename) assert.Equal(t, fileName, rpmFiles[0].Filename)
} }
// createTestRPMFile создает тестовый RPM файл с заглушкой
func createTestRPMFile(filePath string) error {
content := []byte("dummy rpm content")
return os.WriteFile(filePath, content, 0644)
}