Skip to content

Commit

Permalink
Change to pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
kislaykishore committed Aug 7, 2024
1 parent 8743565 commit e4ffc6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cfg/stringify.go → cfg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (o *Octal) UnmarshalText(text []byte) error {
return nil
}

func (o *Octal) MarshalText() (text []byte, err error) {
return []byte(strconv.FormatInt(int64(*o), 8)), nil
func (o Octal) MarshalText() (text []byte, err error) {
return []byte(strconv.FormatInt(int64(o), 8)), nil
}

// Protocol is the datatype that specifies the type of connection: http1/http2/grpc.
Expand Down
8 changes: 4 additions & 4 deletions cfg/stringify_test.go → cfg/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestOctalFieldInConfigStringify(t *testing.T) {
func TestOctalTypeInConfigStringify(t *testing.T) {
c := Config{
FileSystem: FileSystemConfig{
DirMode: 0755,
Expand All @@ -31,15 +31,15 @@ func TestOctalFieldInConfigStringify(t *testing.T) {
str, err := util.Stringify(&c)

if assert.NoError(t, err) {
assert.Equal(t, "", str)
assert.Equal(t, "file-system:\n dir-mode: \"755\"\n", str)
}
}
func TestOctalStringify(t *testing.T) {
o := Octal(0765)

str, err := util.Stringify(o)
str, err := util.Stringify(&o)

if assert.NoError(t, err) {
assert.Equal(t, `"765"`, str)
assert.Equal(t, "\"765\"\n", str)
}
}

0 comments on commit e4ffc6b

Please sign in to comment.