-
Notifications
You must be signed in to change notification settings - Fork 18k
x/mod/sumdb/dirhash: incorrect Unix command example #48498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Friendly ping. Would you accept a PR to fix? I believe the following is the actual command needed to get the correct output:
This fails if the current directory has no files, or if $PREFIX contains a |
cc @bcmills |
Can we just get rid of the Unix command from the comment instead? The marginal increase in clarity does not seem worth the effort of fine-tuning and reviewing a fix to the example command. |
I think that having an example command is useful as a concise overview of what the function does, though saying "prepared as if by the Unix command" seems to imply that the command is supposed to serve as a (close to full) equivalent (which isn't true of course). Perhaps something like this would be a bit better:
While I appreciate the effort, the command given by @MarkLodato seems too complex to serve as a summary. I suspect most Go programmers would come to understand the details of the function more quickly by just reading the code rather than unraveling that command. |
I don't think the code in question is straightforward enough to substitute for proper documentation. I tried to read it and failed. That's why I came here. In particular, I was looking for:
The unit tests don't help because they are themselves complicated code. It would help to have hard-coded test vectors here, which could serve as a form of documentation. Most of the complexity in my command is due to the substitution of
|
Also, to take a step back, I'm not actually looking for documentation for this particular function, but rather for how go module checksumming works overall. Right now that information only exists on this one function. But it's awkward because the A better solution might be moving this description to the top of the file to describe the format overall. Then you can describe the two interfaces to the checksumming: directory (subject to prefix replacement, and only finding normal files) and zip file (no prefix replacement). |
FWIW, here's another option that is exactly correct but perhaps more readable:
|
Change https://go.dev/cl/464295 mentions this issue: |
At https://cs.opensource.google/go/x/mod/+/refs/tags/v0.5.0:sumdb/dirhash/hash.go;l=36, the Unix command equivalent given for
Hash1()
iswhich doesn't really capture what
Hash1()
actually does. It would be less misleading to give an equivalent likeThe text was updated successfully, but these errors were encountered: