Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
timwu20 committed Jun 17, 2022
1 parent 24977ea commit 4a4be32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions pkg/scale/varying_data_type_nested_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewParentVDT() ParentVDT {
// ChildVDT type is used as a VaryingDataTypeValue for ParentVDT
type ChildVDT scale.VaryingDataType

// Index fulfills the VaryingDataTypeValue interface. T
// Index fulfils the VaryingDataTypeValue interface. T
func (cvdt ChildVDT) Index() uint {
return 1
}
Expand Down Expand Up @@ -86,13 +86,13 @@ func NewChildVDT() ChildVDT {
// OtherChildVDT type is used as a VaryingDataTypeValue for ParentVDT
type OtherChildVDT scale.VaryingDataType

// Index fulfills the VaryingDataTypeValue interface.
// Index fulfils the VaryingDataTypeValue interface.
func (ocvdt OtherChildVDT) Index() uint {
return 2
}

// Set will set a VaryingDataTypeValue using the underlying VaryingDataType
func (cvdt *OtherChildVDT) Set(val scale.VaryingDataTypeValue) (err error) {
func (cvdt *OtherChildVDT) Set(val scale.VaryingDataTypeValue) (err error) { //nolint:revive
// cast to VaryingDataType to use VaryingDataType.Set method
vdt := scale.VaryingDataType(*cvdt)
err = vdt.Set(val)
Expand All @@ -119,7 +119,7 @@ func NewOtherChildVDT() OtherChildVDT {
// ChildInt16 is used as a VaryingDataTypeValue for ChildVDT and OtherChildVDT
type ChildInt16 int16

// Index fulfills the VaryingDataTypeValue interface. The ChildVDT type is used as a
// Index fulfils the VaryingDataTypeValue interface. The ChildVDT type is used as a
// VaryingDataTypeValue for ParentVDT
func (ci ChildInt16) Index() uint {
return 1
Expand All @@ -131,20 +131,20 @@ type ChildStruct struct {
B bool
}

// Index fulfills the VaryingDataTypeValue interface
// Index fulfils the VaryingDataTypeValue interface
func (cs ChildStruct) Index() uint {
return 2
}

// ChildString is used as a VaryingDataTypeValue for ChildVDT and OtherChildVDT
type ChildString string

// Index fulfills the VaryingDataTypeValue interface
// Index fulfils the VaryingDataTypeValue interface
func (cs ChildString) Index() uint {
return 3
}

func ExampleNestedVaryingDataType() {
func Example() {
parent := NewParentVDT()

// populate parent with ChildVDT
Expand Down
3 changes: 2 additions & 1 deletion pkg/scale/varying_data_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ func Test_decodeState_decodeCustomVaryingDataType(t *testing.T) {

dstVDT := reflect.ValueOf(tt.in).Convert(reflect.TypeOf(VaryingDataType{})).Interface().(VaryingDataType)
inVDT := reflect.ValueOf(tt.in).Convert(reflect.TypeOf(VaryingDataType{})).Interface().(VaryingDataType)
diff := cmp.Diff(dstVDT.Value(), inVDT.Value(), cmpopts.IgnoreUnexported(big.Int{}, VDTValue2{}, MyStructWithIgnore{}))
diff := cmp.Diff(dstVDT.Value(), inVDT.Value(),
cmpopts.IgnoreUnexported(big.Int{}, VDTValue2{}, MyStructWithIgnore{}))
if diff != "" {
t.Errorf("decodeState.unmarshal() = %s", diff)
}
Expand Down

0 comments on commit 4a4be32

Please sign in to comment.