Small if err cleaning

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
Antonio Murdaca
2015-04-27 21:50:33 +02:00
parent 531ec3cac9
commit 844538142d
29 changed files with 51 additions and 74 deletions
+1 -2
View File
@@ -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
+1 -2
View File
@@ -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 {
+1 -2
View File
@@ -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)
+1 -2
View File
@@ -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)
+1 -2
View File
@@ -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
}
}