Skip to content

Commit

Permalink
Various fixes from the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Jun 3, 2023
1 parent 4e70836 commit 1eff803
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions cmd/osdf_stage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ Terminology:
correspondings to the files in the origin prefix. Example:
/mnt/cephfs/protected
- Shadow prefix: Where in the OSDF namespace the resulting files should
be uploaded. Example: osdf://osg-connect-shadow/protected
`);
be uploaded. Example: osdf://osg-connect-shadow/protected`);
os.Exit(0)
} else {
log.Errorln(err)
Expand Down Expand Up @@ -152,7 +151,7 @@ Terminology:
log.Errorln("TransferInput is not a string")
os.Exit(1)
}
re := regexp.MustCompile("[,\\s]+")
re := regexp.MustCompile(`[,\s]+`)
for _, source := range re.Split(inputListStr, -1) {
log.Debugln("Examining transfer input file", source)
if (strings.HasPrefix(source, options.MountPrefix)) {
Expand Down
2 changes: 1 addition & 1 deletion handle_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ func StatHttp(dest *url.URL, namespace Namespace) (uint64, error) {
}
contentLength, err := strconv.ParseInt(contentLengthStr, 10, 64)
if err != nil {
log.Errorln("Unable to parse Content-Length header value (%s) as integer: %s", contentLengthStr, err)
log.Errorf("Unable to parse Content-Length header value (%s) as integer: %s", contentLengthStr, err)
return 0, err
}
return uint64(contentLength), nil
Expand Down
4 changes: 4 additions & 0 deletions handle_ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func generate_destination(filePath string, originPrefix string, shadowOriginPref
}

func DoShadowIngest(sourceFile string, originPrefix string, shadowOriginPrefix string) (int64, string, error) {
// After each transfer attempt, we'll check to see if the local file was modified. If so, we'll re-upload.
for idx := 0; idx < 10; idx++ {
shadowFile, localSize, err := generate_destination(sourceFile, originPrefix, shadowOriginPrefix)
log.Debugln("Resulting shadow URL:", shadowFile)
Expand Down Expand Up @@ -85,6 +86,9 @@ func DoShadowIngest(sourceFile string, originPrefix string, shadowOriginPrefix s
}

uploadBytes, err := DoStashCPSingle(sourceFile, shadowFile, methods, false)
if err != nil {
return 0, "", err
}

// See if the file was modified while we were uploading; if not, we'll return success
shadowFilePost, _, err := generate_destination(sourceFile, originPrefix, shadowOriginPrefix)
Expand Down

0 comments on commit 1eff803

Please sign in to comment.