refactor: rename constructor
This commit is contained in:
parent
208f50324a
commit
c44c11d264
|
@ -18,7 +18,7 @@ type Multihash struct {
|
||||||
FullBytes []byte
|
FullBytes []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMultihash(fullBytes []byte) *Multihash {
|
func New(fullBytes []byte) *Multihash {
|
||||||
return &Multihash{FullBytes: fullBytes}
|
return &Multihash{FullBytes: fullBytes}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ func FromBase64Url(hash string) (*Multihash, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return NewMultihash(ret), nil
|
return New(ret), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Multihash) ToBase64Url() (string, error) {
|
func (m *Multihash) ToBase64Url() (string, error) {
|
||||||
|
|
|
@ -203,8 +203,8 @@ func TestNewMultihash(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if got := NewMultihash(tt.args.fullBytes); !reflect.DeepEqual(got, tt.want) {
|
if got := New(tt.args.fullBytes); !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("NewMultihash() = %v, want %v", got, tt.want)
|
t.Errorf("New() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue