[x] All tests passed. If this feature is not already covered by the tests, I added new tests.
[x] This pull request is on the dev branch.
[x] I used gofmt for formatting the code before submitting the pull request.
The struct entities.Checksum located in a few places as an embedded field.
It's bad practice to use it as a pointer and not a struct for a couple of reasons:
First, most of the time, the wrapper struct, which entities.Checksum is embedded inside, is a pointer itself, so there is no real benefit for using nested pointers.
Seconds, entities.Checksum fields are string, when referencing one of the fields, it looks like no nil check is required but entities.Checksum itself could be nil.
This may open the door for runtime exceptions such as here https://github.com/jfrog/jfrog-cli/issues/1297.
The solution to this problem is simple, use struct instead of pointer as embedded field.
Related PRs:
[x] I used gofmt for formatting the code before submitting the pull request.
The struct
entities.Checksum
located in a few places as an embedded field. It's bad practice to use it as a pointer and not a struct for a couple of reasons:First, most of the time, the wrapper struct, which
entities.Checksum
is embedded inside, is a pointer itself, so there is no real benefit for using nested pointers. Seconds,entities.Checksum
fields are string, when referencing one of the fields, it looks like no nil check is required butentities.Checksum
itself could be nil. This may open the door for runtime exceptions such as here https://github.com/jfrog/jfrog-cli/issues/1297.The solution to this problem is simple, use struct instead of pointer as embedded field. Related PRs: