Make repo_add.go only replace the last suffix in the path when generating a lockfile

Signed-off-by: Guy Bolton King <guy@waftex.com>
pull/10590/head
Guy Bolton King 3 years ago
parent 4367fe0c1e
commit 8b1c28427f
No known key found for this signature in database
GPG Key ID: A5F222BE0AC7C0E1

@ -119,7 +119,7 @@ func (o *repoAddOptions) run(out io.Writer) error {
repoFileExt := filepath.Ext(o.repoFile)
var lockPath string
if len(repoFileExt) > 0 && len(repoFileExt) < len(o.repoFile) {
lockPath = strings.Replace(o.repoFile, repoFileExt, ".lock", 1)
lockPath = strings.TrimSuffix(o.repoFile, repoFileExt) + ".lock"
} else {
lockPath = o.repoFile + ".lock"
}

Loading…
Cancel
Save