Use short if

pull/1121/head
Ville Skyttä 4 years ago
parent ce9d35436e
commit 633e77013f

@ -32,8 +32,7 @@ func TestReadLinesOffsetN(t *testing.T) {
func TestIntToString(t *testing.T) { func TestIntToString(t *testing.T) {
src := []int8{65, 66, 67} src := []int8{65, 66, 67}
dst := IntToString(src) if dst := IntToString(src); dst != "ABC" {
if dst != "ABC" {
t.Error("could not convert") t.Error("could not convert")
} }
} }
@ -58,8 +57,7 @@ func TestHexToUint32(t *testing.T) {
} }
func TestMustParseInt32(t *testing.T) { func TestMustParseInt32(t *testing.T) {
ret := mustParseInt32("11111") if ret := mustParseInt32("11111"); ret != int32(11111) {
if ret != int32(11111) {
t.Error("could not parse") t.Error("could not parse")
} }
} }
@ -102,8 +100,7 @@ func TestHostEtc(t *testing.T) {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
t.Skip("windows doesn't have etc") t.Skip("windows doesn't have etc")
} }
p := HostEtc("mtab") if p := HostEtc("mtab"); p != "/etc/mtab" {
if p != "/etc/mtab" {
t.Errorf("invalid HostEtc, %s", p) t.Errorf("invalid HostEtc, %s", p)
} }
} }

@ -26,8 +26,7 @@ func AvgWithContext(ctx context.Context) (*AvgStat, error) {
func sysinfoAvgWithContext(ctx context.Context) (*AvgStat, error) { func sysinfoAvgWithContext(ctx context.Context) (*AvgStat, error) {
var info syscall.Sysinfo_t var info syscall.Sysinfo_t
err := syscall.Sysinfo(&info) if err := syscall.Sysinfo(&info); err != nil {
if err != nil {
return nil, err return nil, err
} }

Loading…
Cancel
Save