Skip to content

Commit

Permalink
🎨 style: update and fix some code style error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 27, 2023
1 parent 6eea491 commit f551b33
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions byteutil/byteutil.go
@@ -1,3 +1,4 @@
// Package byteutil provides some useful functions for byte slice.
package byteutil

import (
Expand Down
3 changes: 1 addition & 2 deletions byteutil/conv.go
Expand Up @@ -103,8 +103,7 @@ func ToBytesWithFunc(v any, usrFn ToBytesFunc) ([]byte, error) {
default:
if usrFn == nil {
return nil, comdef.ErrConvType
} else {
return usrFn(val)
}
return usrFn(val)
}
}
2 changes: 1 addition & 1 deletion dump/dump_test.go
Expand Up @@ -290,7 +290,7 @@ func ExampleStruct_mapInterfacedValue() {
fmt.Println(s2)
}

func TestStruct_ptrField(t *testing.T) {
func TestStruct_ptrField(_ *testing.T) {
type userOpts struct {
Int *int
// use ptr
Expand Down
2 changes: 1 addition & 1 deletion dump/dumper_test.go
Expand Up @@ -154,7 +154,7 @@ func TestDump_Ptr(t *testing.T) {
}

// code from https://stackoverflow.com/questions/42664837/how-to-access-unexported-struct-fields-in-golang
func TestDumper_AccessCantExportedField(t *testing.T) {
func TestDumper_AccessCantExportedField(_ *testing.T) {
type MyStruct struct {
// id string
id any
Expand Down
8 changes: 4 additions & 4 deletions maputil/format.go
Expand Up @@ -92,16 +92,16 @@ func (f *MapFormatter) doFormat() {
}

for i, key := range rv.MapKeys() {
kStr := strutil.QuietString(key.Interface())
strK := strutil.SafeString(key.Interface())
if indentLn > 0 {
buf.WriteString(f.Indent)
}

buf.WriteString(kStr)
buf.WriteString(strK)
buf.WriteByte(':')

vStr := strutil.QuietString(rv.MapIndex(key).Interface())
buf.WriteString(vStr)
strV := strutil.SafeString(rv.MapIndex(key).Interface())
buf.WriteString(strV)
if i < ln-1 {
buf.WriteByte(',')

Expand Down

0 comments on commit f551b33

Please sign in to comment.