Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
f023195a1e
commit
2026dbd41d
5 changed files with 5 additions and 10 deletions
|
@ -65,8 +65,7 @@ import (
|
|||
func (mj *JSONLog) MarshalJSON() ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
buf.Grow(1024)
|
||||
err := mj.MarshalJSONBuf(&buf)
|
||||
if err != nil {
|
||||
if err := mj.MarshalJSONBuf(&buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
|
|
|
@ -486,8 +486,7 @@ func (f *FlagSet) Set(name, value string) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("no such flag -%v", name)
|
||||
}
|
||||
err := flag.Value.Set(value)
|
||||
if err != nil {
|
||||
if err := flag.Value.Set(value); err != nil {
|
||||
return err
|
||||
}
|
||||
if f.actual == nil {
|
||||
|
|
|
@ -12,8 +12,7 @@ import (
|
|||
// Throws an error if the file does not exist
|
||||
func Lstat(path string) (*Stat_t, error) {
|
||||
s := &syscall.Stat_t{}
|
||||
err := syscall.Lstat(path, s)
|
||||
if err != nil {
|
||||
if err := syscall.Lstat(path, s); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fromStatT(s)
|
||||
|
|
|
@ -20,8 +20,7 @@ func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
|||
// Throws an error if the file does not exist
|
||||
func Stat(path string) (*Stat_t, error) {
|
||||
s := &syscall.Stat_t{}
|
||||
err := syscall.Stat(path, s)
|
||||
if err != nil {
|
||||
if err := syscall.Stat(path, s); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fromStatT(s)
|
||||
|
|
|
@ -17,8 +17,7 @@ type conn struct {
|
|||
|
||||
func (c *conn) Read(b []byte) (int, error) {
|
||||
if c.timeout > 0 {
|
||||
err := c.Conn.SetReadDeadline(time.Now().Add(c.timeout))
|
||||
if err != nil {
|
||||
if err := c.Conn.SetReadDeadline(time.Now().Add(c.timeout)); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue