Skip to content
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

go-get checksum file & guess checksum #136

Merged
merged 43 commits into from
Jan 8, 2019
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a67abad
allow to get checksum from go-gettere'd file
azr Dec 3, 2018
ee889a1
checksum from file: error managment + tests + fixes
azr Dec 3, 2018
59bde3e
checksumsFromFile: name tmp file identically as checksum file
azr Dec 3, 2018
5c32c13
doc checksumsFromFile
azr Dec 3, 2018
d070edd
add bad gnu checksum test for checksumsFromFile
azr Dec 3, 2018
f5f3893
better error message in checksumHashAndValue
azr Dec 3, 2018
e47d598
doc more
azr Dec 3, 2018
dd14d29
checksumHashAndValue return a type even if there is no semicolor for …
azr Dec 3, 2018
46d4103
add Test_checksumHashAndValue + test with local files and remove Test…
azr Dec 4, 2018
83d4bc7
doc a bit more
azr Dec 4, 2018
61f3e8c
checksum.go: remove blank line
azr Dec 13, 2018
8b22fcb
checksum_test.go: remove blank line
azr Dec 13, 2018
d677d02
more README about checksumming + rewrap
azr Dec 13, 2018
a40aca3
simplify checksum code by add a fileChecksum struct that carries chec…
azr Dec 14, 2018
7e5e3f3
add tests for actual checksumming
azr Dec 14, 2018
98c09d8
comment fileChecksum better
azr Dec 14, 2018
37778c7
rename checksumHashAndValue => extractChecksum and document it a bit …
azr Dec 14, 2018
a0e541e
put extractChecksum on top of checksum.go as it is file entrypoint
azr Dec 14, 2018
611f0bc
test file checksumming from GetFile for simplicity instead of testing…
azr Dec 14, 2018
80b41a1
make tempFile not clean the tempDir as tests could happen in parallel
azr Dec 14, 2018
fc13d7e
copy client in order to get checksum file
azr Jan 8, 2019
4c4dfb6
go-imports
azr Jan 8, 2019
6c797bb
add more tests in TestGetFile_checksum_from_file
azr Dec 14, 2018
581bb3d
Delete checksum_test.go
azr Dec 14, 2018
0ca2927
remove tempFile in tests
azr Dec 14, 2018
a8aa720
allow to not pass the checksumming type in order to guess it based on…
azr Dec 14, 2018
76aee45
file checksum: also allow to for file to only contain the hash or hav…
azr Dec 14, 2018
5b3a85d
Revert "make tempFile not clean the tempDir as tests could happen in …
azr Dec 14, 2018
2a247a3
checksum: add test for sha1 file only containing sha1
azr Dec 18, 2018
f60bf8f
remove tests on bsd formated shas checksum files
azr Dec 18, 2018
e4ac591
update doc about checksum file get behavior
azr Dec 18, 2018
a6260be
remove named parameters of SourceDirSubdir and document it with examp…
azr Dec 19, 2018
af65cf6
also test getting a checksum from a httptest Server
azr Dec 20, 2018
91417d4
Update README.md
azr Dec 20, 2018
707413a
Update doc for checksumsFromFile
azr Dec 20, 2018
9c5e467
be more precise in the README about temporary location selection
azr Jan 8, 2019
8747bdc
don't ignore path errors
azr Jan 8, 2019
666e5d0
checksumming: simplify a defer os.Remove(tempfile) call
azr Jan 8, 2019
82e7318
move checksum func to checksum.go
azr Jan 8, 2019
9693100
simplify tmpFile call
azr Jan 8, 2019
7607f9c
merge tmpFile and tempFile usages
azr Jan 8, 2019
1ebd7bf
Revert "merge tmpFile and tempFile usages"
vancluever Jan 8, 2019
6d796ed
tests: Small helper function rename/refactor
vancluever Jan 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README.md
  • Loading branch information
azr committed Jan 8, 2019
commit 91417d489869d29fa1f45d1991889836a6264cdc
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,13 @@ For file downloads of any protocol, go-getter can automatically verify
a checksum for you. Note that checksumming only works for downloading files,
not directories, but checksumming will work for any protocol.

To checksum a file, append a `checksum` query parameter to the URL.
The parameter value should be in the format of `type:value`, where
type is "md5", "sha1", "sha256", "sha512" or "file". The "value" should be
the actual checksum value or download URL for "file".
When `type` part is omitted it will be guessed based on the length
of the checksum string.
go-getter will parse out this query parameter automatically
and use it to verify the checksum.
Examples:
To checksum a file, append a `checksum` query parameter to the URL. go-getter
will parse out this query parameter automatically and use it to verify the
checksum. The parameter value can be in the format of `type:value` or just
`value`, where type is "md5", "sha1", "sha256", "sha512" or "file" . The
"value" should be the actual checksum value or download URL for "file". When
`type` part is omitted, type will be guessed based on the length of the
checksum string. Examples:

```
./foo.txt?checksum=md5:b7d96c89d09d9e204f5fedc4d5d55b21
Expand All @@ -178,11 +176,10 @@ Examples:
```

When checksumming from a file - ex: with `checksum=file:url` - go-getter will
get the file linked in the URL after `file:` using the same client
(`client.Get(`). For example, in
`file:http://releases.ubuntu.com/cosmic/MD5SUMS` go-getter will download a
checksum file under the aforementioned url using the http protocol. All
protocols supported by go-getter can be used. The checksum file will be
get the file linked in the URL after `file:` using the same configuration. For
example, in `file:http://releases.ubuntu.com/cosmic/MD5SUMS` go-getter will
download a checksum file under the aforementioned url using the http protocol.
All protocols supported by go-getter can be used. The checksum file will be
downloaded in a temporary file then parsed. The destination of the temporary
file can be changed by setting system specific environment variables: `TMPDIR`
for unix; `TMP`, `TEMP` or `USERPROFILE` on windows. Read godoc of
Expand Down