Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 474bc5f

Browse files
committed
Various fixes from the linter
1 parent 6520157 commit 474bc5f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cmd/osdf_stage/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ Terminology:
7373
correspondings to the files in the origin prefix. Example:
7474
/mnt/cephfs/protected
7575
- Shadow prefix: Where in the OSDF namespace the resulting files should
76-
be uploaded. Example: osdf://osg-connect-shadow/protected
77-
`);
76+
be uploaded. Example: osdf://osg-connect-shadow/protected`);
7877
os.Exit(0)
7978
} else {
8079
log.Errorln(err)
@@ -152,7 +151,7 @@ Terminology:
152151
log.Errorln("TransferInput is not a string")
153152
os.Exit(1)
154153
}
155-
re := regexp.MustCompile("[,\\s]+")
154+
re := regexp.MustCompile(`[,\s]+`)
156155
for _, source := range re.Split(inputListStr, -1) {
157156
log.Debugln("Examining transfer input file", source)
158157
if (strings.HasPrefix(source, options.MountPrefix)) {

handle_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ func StatHttp(dest *url.URL, namespace Namespace) (uint64, error) {
971971
}
972972
contentLength, err := strconv.ParseInt(contentLengthStr, 10, 64)
973973
if err != nil {
974-
log.Errorln("Unable to parse Content-Length header value (%s) as integer: %s", contentLengthStr, err)
974+
log.Errorf("Unable to parse Content-Length header value (%s) as integer: %s", contentLengthStr, err)
975975
return 0, err
976976
}
977977
return uint64(contentLength), nil

handle_ingest.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func generate_destination(filePath string, originPrefix string, shadowOriginPref
3535
}
3636

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

8788
uploadBytes, err := DoStashCPSingle(sourceFile, shadowFile, methods, false)
89+
if err != nil {
90+
return 0, "", err
91+
}
8892

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

0 commit comments

Comments
 (0)