Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joakim Bygdell <joakim.bygdell@nbis.se>
  • Loading branch information
pahatz and jbygdell committed Oct 23, 2024
1 parent a471ce6 commit 4b57b91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var pubKeyPath = Args.String("encrypt-with-key", "",
var accessToken = Args.String("accessToken", "", "Access token to the inbox service.\n(optional, if it is set in the config file or exported as the ENV `ACCESSTOKEN`)")

// Function uploadFiles uploads the files in the input list to the s3 bucket
func uploadFiles(files, outFiles []string, targetDir string, config *helpers.Config, configPath string) error {
func uploadFiles(files, outFiles []string, targetDir string, config *helpers.Config) error {
// check also here in case sth went wrong with input files
if len(files) == 0 {
return errors.New("no files to upload")
Expand Down Expand Up @@ -123,8 +123,6 @@ func uploadFiles(files, outFiles []string, targetDir string, config *helpers.Con

// create progress bar instance
p := mpb.New()
log.Infof("Uploading %s with config %s\n", filename, configPath)
fmt.Printf("Uploading %s with config %s\n", filename, configPath)

f, err := os.Open(path.Clean(filename))
if err != nil {
Expand Down Expand Up @@ -362,5 +360,5 @@ func Upload(args []string, configPath string) error {
}
}

return uploadFiles(files, outFiles, filepath.ToSlash(*targetDir), config, configPath)
return uploadFiles(files, outFiles, filepath.ToSlash(*targetDir), config)
}
2 changes: 1 addition & 1 deletion upload/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (suite *TestSuite) TestSampleNoFiles() {
config, _ := helpers.LoadConfigFile(configPath.Name())
var files []string

err = uploadFiles(files, files, "", config, configPath.Name())
err = uploadFiles(files, files, "", config)
assert.EqualError(suite.T(), err, "no files to upload")
}

Expand Down

0 comments on commit 4b57b91

Please sign in to comment.