forked from TrueCloudLab/frostfs-api-go
[#388] *: Remove nil check from setters
I knew one day `sed` would save me an hour of manual work: ``` sed -i -n -e ' s/) Set/) Set/ p t setter b end :setter n s/nil/nil/ t hasif p b end :hasif n :loop p n s/}/}/ t end b loop :end ' $@ goimports -w $@ ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
50162741ac
commit
732dd51b1b
32 changed files with 714 additions and 2104 deletions
|
@ -2,100 +2,72 @@ package refs
|
|||
|
||||
// SetValue sets container identifier in a binary format.
|
||||
func (x *ContainerID) SetValue(v []byte) {
|
||||
if x != nil {
|
||||
x.Value = v
|
||||
}
|
||||
x.Value = v
|
||||
}
|
||||
|
||||
// SetValue sets object identifier in a binary format.
|
||||
func (x *ObjectID) SetValue(v []byte) {
|
||||
if x != nil {
|
||||
x.Value = v
|
||||
}
|
||||
x.Value = v
|
||||
}
|
||||
|
||||
// SetValue sets owner identifier in a binary format.
|
||||
func (x *OwnerID) SetValue(v []byte) {
|
||||
if x != nil {
|
||||
x.Value = v
|
||||
}
|
||||
x.Value = v
|
||||
}
|
||||
|
||||
// SetContainerId sets container identifier of the address.
|
||||
func (x *Address) SetContainerId(v *ContainerID) {
|
||||
if x != nil {
|
||||
x.ContainerId = v
|
||||
}
|
||||
x.ContainerId = v
|
||||
}
|
||||
|
||||
// SetObjectId sets object identifier of the address.
|
||||
func (x *Address) SetObjectId(v *ObjectID) {
|
||||
if x != nil {
|
||||
x.ObjectId = v
|
||||
}
|
||||
x.ObjectId = v
|
||||
}
|
||||
|
||||
// SetChecksumType in generic checksum structure.
|
||||
func (x *Checksum) SetChecksumType(v ChecksumType) {
|
||||
if x != nil {
|
||||
x.Type = v
|
||||
}
|
||||
x.Type = v
|
||||
}
|
||||
|
||||
// SetSum in generic checksum structure.
|
||||
func (x *Checksum) SetSum(v []byte) {
|
||||
if x != nil {
|
||||
x.Sum = v
|
||||
}
|
||||
x.Sum = v
|
||||
}
|
||||
|
||||
// SetMajor sets major version number.
|
||||
func (x *Version) SetMajor(v uint32) {
|
||||
if x != nil {
|
||||
x.Major = v
|
||||
}
|
||||
x.Major = v
|
||||
}
|
||||
|
||||
// SetMinor sets minor version number.
|
||||
func (x *Version) SetMinor(v uint32) {
|
||||
if x != nil {
|
||||
x.Minor = v
|
||||
}
|
||||
x.Minor = v
|
||||
}
|
||||
|
||||
// SetKey sets public key in a binary format.
|
||||
func (x *Signature) SetKey(v []byte) {
|
||||
if x != nil {
|
||||
x.Key = v
|
||||
}
|
||||
x.Key = v
|
||||
}
|
||||
|
||||
// SetSign sets signature.
|
||||
func (x *Signature) SetSign(v []byte) {
|
||||
if x != nil {
|
||||
x.Sign = v
|
||||
}
|
||||
x.Sign = v
|
||||
}
|
||||
|
||||
// SetScheme sets signature scheme.
|
||||
func (x *Signature) SetScheme(s SignatureScheme) {
|
||||
if x != nil {
|
||||
x.Scheme = s
|
||||
}
|
||||
x.Scheme = s
|
||||
}
|
||||
|
||||
// SetKey sets public key in a binary format.
|
||||
func (x *SignatureRFC6979) SetKey(v []byte) {
|
||||
if x != nil {
|
||||
x.Key = v
|
||||
}
|
||||
x.Key = v
|
||||
}
|
||||
|
||||
// SetSign sets signature.
|
||||
func (x *SignatureRFC6979) SetSign(v []byte) {
|
||||
if x != nil {
|
||||
x.Sign = v
|
||||
}
|
||||
x.Sign = v
|
||||
}
|
||||
|
||||
// FromString parses SignatureScheme from a string representation,
|
||||
|
@ -126,7 +98,5 @@ func (x *ChecksumType) FromString(s string) bool {
|
|||
|
||||
// SetValue sets subnet identifier in a base-10 integer format.
|
||||
func (x *SubnetID) SetValue(v uint32) {
|
||||
if x != nil {
|
||||
x.Value = v
|
||||
}
|
||||
x.Value = v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue