builder/remotecontext: remove unused named and "naked" returns
Also renamed some vars for clarity, renamed a error-returns to prevent shadowing, and fixed some linter warnings about unhandled errors. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -46,7 +46,7 @@ func Clone(remoteURL string, opts ...CloneOption) (string, error) {
|
||||
return repo.clone()
|
||||
}
|
||||
|
||||
func (repo gitRepo) clone() (checkoutDir string, err error) {
|
||||
func (repo gitRepo) clone() (checkoutDir string, retErr error) {
|
||||
fetch := fetchArgs(repo.remote, repo.ref)
|
||||
|
||||
root, err := os.MkdirTemp("", "docker-build-git")
|
||||
@ -55,8 +55,8 @@ func (repo gitRepo) clone() (checkoutDir string, err error) {
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
os.RemoveAll(root)
|
||||
if retErr != nil {
|
||||
_ = os.RemoveAll(root)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user