From 52a987cb10f7321884feeedcab09fc1584310736 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Sat, 30 Mar 2024 21:16:39 +0000 Subject: [PATCH] Renamed `Kaitai_IO` -> `IO_` as per PR discussion --- kaitai/struct.go | 10 +++++----- kaitai/struct_test.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kaitai/struct.go b/kaitai/struct.go index 0facd02..9a49878 100644 --- a/kaitai/struct.go +++ b/kaitai/struct.go @@ -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 } diff --git a/kaitai/struct_test.go b/kaitai/struct_test.go index 250fc02..7cdf9c0 100644 --- a/kaitai/struct_test.go +++ b/kaitai/struct_test.go @@ -13,7 +13,7 @@ type oneStruct struct { _io *Stream } -func (s *oneStruct) Kaitai_IO() *Stream { +func (s *oneStruct) IO_() *Stream { return s._io } @@ -22,13 +22,13 @@ type twoStruct struct { _io *Stream } -func (s *twoStruct) Kaitai_IO() *Stream { +func (s *twoStruct) IO_() *Stream { 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)) }