Closed xplshn closed 4 months ago
No. sha256 is there to clarify it's sha256, not sha512 or any other variants. Likewise it's same with bsum, it's written as b3sum to clarify it's b3sum and not any other variant.
Your gocode assumes Sha as sha256 by default. Which is to say, this will create issues and conflicts in the future, if I were to start using sha512, or b4sum. Use a library or clearly define what particular checksum version does your 'sha' indicates, rather than simply just using 'sha' as placeholder value.
Also, the Sha you are getting from GitHub's api is not actual shasum of the files, but rather commits. Unless you mean, using tree path's Sha, in which case you are getting sha1sum and not sha256, https://stackoverflow.com/questions/26203603/how-do-i-get-the-sha-parameter-from-github-api-without-downloading-the-whole-f I played around this over a year ago, I had to manually calculate sha256sums using traditional tools and by downloading files locally because GitHub's api didn't provide it.
I won't be regressing from sha256 back to sha1, if anything I will likely start generating sha512, or maybe something even better/newer. The same goes for bsum.
I didn't mention it, because I thought it was clear; This is the code for listing binaries. There are no conflicts, I just need something other than the name to tell apart binaries.
The only issue would be that you won't use "sha" instead of "sha256" as the field name. In any case, that's fine. It would just have been way better for me, and you could simply document how and what the JSON fields contain, so that anyone who needs to use the JSONs for creating a program like BigDL or etc can use it. Its not something that would concern users nor bother anyone working with the JSONs, its just a field rename.
@
Hi, recently, I've been trying to implement duplicates filtering based on the SHA of the binaries, however, the cyclomatic complexity is high due to the fact that I have to implement a way to work with the JSONs from your repo, and a way to work with the JSONs from github, and its quite difficult because the struct has to have two sha fields, and so the only way to get it working is using JANKY and ugly code, it'd all be much simpler for me if the fields matched.
This is how it would look if the field were named "sha" and not "sha256"
This is how it looks if I were to remove duplicates based on the sha256 and sha fields. The complexity here is way higher, because I am iterating through repos and I not only have to remove the duplicates once, but I also have to make sure to remove duplicates with the "sha" field and not the "sha256".