Skip to content

Commit

Permalink
Update resource.go
Browse files Browse the repository at this point in the history
deleted my code under the geturltodir function and added the missing line that was requested
  • Loading branch information
777Denoiser authored Dec 4, 2024
1 parent a261d0c commit d4a4c74
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions internal/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,7 @@ func GetUrlToDir(u string, targetDir string, ctx context.Context) (string, error
h := sha256.New()
h.Write([]byte(u))
fileName := filepath.Join(targetDir, fmt.Sprintf(".%s", hex.EncodeToString(h.Sum(nil))))

Check failure on line 71 in internal/resource.go

View workflow job for this annotation

GitHub Actions / ci

declared and not used: fileName

// Create new file with immediate close
file, err := os.Create(fileName)
if err != nil {
return "", fmt.Errorf("failed to create file: %v", err)
}
file.Close()

fileName, err = getUrl(u, fileName, ctx)
if err != nil {
return "", err
}

return fileName, nil
return getUrl(u, filename, ctx)

Check failure on line 72 in internal/resource.go

View workflow job for this annotation

GitHub Actions / ci

undefined: filename
}

// GetUrlWithDir downloads the given resource to a temporary file and returns the path to it.
Expand Down

0 comments on commit d4a4c74

Please sign in to comment.