Skip to content

Commit

Permalink
Renamed Kaitai_IO -> IO_ as per PR discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Mar 30, 2024
1 parent 9f594fd commit 52a987c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions kaitai/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package kaitai
// Struct is the common interface guaranteed to be implemented by all types generated by
// Kaitai Struct compiler.
type Struct interface {
// Kaitai_IO returns the stream object associated with the struct.
// IO_ returns the stream object associated with the struct.
//
// This is deliberately named with a `Kaitai_` prefix and underscore to avoid conflicts
// with other methods that may result from the attributes in Kaitai Struct type, e.g.
// is a user will define attribute `i_o` this will conflict with the method `IO()`.
Kaitai_IO() *Stream
// This is deliberately named with a `_` suffix to avoid conflicts with other methods
// that may result from the attributes in Kaitai Struct type, e.g. if a user will define
// attribute `i_o` this will conflict with the method `IO()`.
IO_() *Stream
}
6 changes: 3 additions & 3 deletions kaitai/struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type oneStruct struct {
_io *Stream
}

func (s *oneStruct) Kaitai_IO() *Stream {
func (s *oneStruct) IO_() *Stream {

Check warning on line 16 in kaitai/struct_test.go

View workflow job for this annotation

GitHub Actions / Lint

var-naming: don't use underscores in Go names; method IO_ should be IO (revive)
return s._io
}

Expand All @@ -22,13 +22,13 @@ type twoStruct struct {
_io *Stream
}

func (s *twoStruct) Kaitai_IO() *Stream {
func (s *twoStruct) IO_() *Stream {

Check warning on line 25 in kaitai/struct_test.go

View workflow job for this annotation

GitHub Actions / Lint

var-naming: don't use underscores in Go names; method IO_ should be IO (revive)
return s._io
}

func WorkWithStruct(t *testing.T, s Struct, expectedSize int) {
t.Helper()
actualSize, err := s.Kaitai_IO().Size()
actualSize, err := s.IO_().Size()
assert.Nil(t, err)
assert.Equal(t, actualSize, int64(expectedSize))
}
Expand Down

0 comments on commit 52a987c

Please sign in to comment.