style: fix lint errors
This commit is contained in:
parent
eb0483734e
commit
a433b4fc7a
1 changed files with 4 additions and 10 deletions
|
@ -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)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue