Skip to content

Commit

Permalink
👔 chore: update some deps to latest, and update some type comments
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 24, 2024
1 parent dc3c50a commit 7c5136a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
9 changes: 5 additions & 4 deletions byteutil/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ func (b *Buffer) writeAnysWithNl(vs []any, nl bool) {
}
}

// Printf quiet write message to buffer, ignore error.
func (b *Buffer) Printf(tpl string, vs ...any) {
_, _ = b.WriteString(fmt.Sprintf(tpl, vs...))
}
// Printf quick write message to buffer, ignore error.
func (b *Buffer) Printf(tpl string, vs ...any) { _, _ = fmt.Fprintf(b, tpl, vs...) }

// Println quick write message with newline to buffer, will ignore error.
func (b *Buffer) Println(vs ...any) { _, _ = fmt.Fprintln(b, vs...) }

// ResetGet buffer string. alias of ResetAndGet()
func (b *Buffer) ResetGet() string {
Expand Down
7 changes: 5 additions & 2 deletions byteutil/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ func TestBuffer_WriteAny(t *testing.T) {
buf.WriteAny(23, "abc")
assert.Eq(t, "23abc", buf.ResetGet())

buf.Writeln("abc")
assert.Eq(t, "abc\n", buf.ResetAndGet())
buf.Writeln("abc", 123)
assert.Eq(t, "abc123\n", buf.ResetAndGet())

buf.Println("abc", 123)
assert.Eq(t, "abc 123\n", buf.ResetAndGet())

assert.NoErr(t, buf.Close())
assert.NoErr(t, buf.Flush())
Expand Down
2 changes: 1 addition & 1 deletion comdef/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type SimpleType interface {
Int | Uint | Float | ~string | ~bool
}

// ScalarType interface type.
// ScalarType basic interface type.
//
// TIP: has bool type, it cannot be ordered
//
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.19
require (
github.com/gookit/color v1.5.4
golang.org/x/sync v0.6.0
golang.org/x/sys v0.16.0
golang.org/x/term v0.16.0
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0
golang.org/x/text v0.14.0
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJu
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2 changes: 2 additions & 0 deletions netutil/httpreq/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ func ResponseToString(w *http.Response) string {
}

// ParseAccept header to strings. referred from gin framework
//
// eg: acceptHeader = "application/json, text/plain, */*"
func ParseAccept(acceptHeader string) []string {
if acceptHeader == "" {
return []string{}
Expand Down
2 changes: 1 addition & 1 deletion testutil/assert/asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func Nil(t TestingT, give any, fmtAndArgs ...any) bool {
}

t.Helper()
return fail(t, fmt.Sprintf("Expected nil, but got: %#v", give), fmtAndArgs)
return fail(t, fmt.Sprintf("Expected nil, but got:\n %+v", give), fmtAndArgs)
}

// NotNil asserts that the given is a not nil value
Expand Down

0 comments on commit 7c5136a

Please sign in to comment.