From e42d422410c39c80ae7d0a8a4bbef94cc43379a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dejan=20Miji=C4=87?= Date: Fri, 16 Mar 2018 14:06:12 +0100 Subject: [PATCH] Fix golint warnings (#189) * Fix goling warnings Signed-off-by: Dejan Mijic * Bump version to 0.1.2 Signed-off-by: Dejan Mijic --- manager/postgres/channels.go | 4 +++- manager/postgres/clients.go | 8 ++------ manager/postgres/init.go | 2 +- manager/postgres/users.go | 2 +- version.go | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/manager/postgres/channels.go b/manager/postgres/channels.go index 716d0bec..86d72dda 100644 --- a/manager/postgres/channels.go +++ b/manager/postgres/channels.go @@ -2,7 +2,7 @@ package postgres import ( "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/postgres" // required by GORM "github.com/mainflux/mainflux/manager" uuid "github.com/satori/go.uuid" ) @@ -13,6 +13,8 @@ type channelRepository struct { db *gorm.DB } +// NewChannelRepository instantiates a PostgreSQL implementation of channel +// repository. func NewChannelRepository(db *gorm.DB) manager.ChannelRepository { return &channelRepository{db} } diff --git a/manager/postgres/clients.go b/manager/postgres/clients.go index e7c03d3a..2bb21f3b 100644 --- a/manager/postgres/clients.go +++ b/manager/postgres/clients.go @@ -2,7 +2,7 @@ package postgres import ( "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/postgres" // required by GORM "github.com/mainflux/mainflux/manager" uuid "github.com/satori/go.uuid" ) @@ -24,11 +24,7 @@ func (cr *clientRepository) Id() string { } func (cr *clientRepository) Save(client manager.Client) error { - if err := cr.db.Create(&client).Error; err != nil { - return err - } - - return nil + return cr.db.Create(&client).Error } func (cr *clientRepository) Update(client manager.Client) error { diff --git a/manager/postgres/init.go b/manager/postgres/init.go index 4eb6b0c0..a07ff287 100644 --- a/manager/postgres/init.go +++ b/manager/postgres/init.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/postgres" // required by GORM "github.com/mainflux/mainflux/manager" ) diff --git a/manager/postgres/users.go b/manager/postgres/users.go index 93deafbb..3bfce7c8 100644 --- a/manager/postgres/users.go +++ b/manager/postgres/users.go @@ -2,7 +2,7 @@ package postgres import ( "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/postgres" // required by GORM "github.com/lib/pq" "github.com/mainflux/mainflux/manager" ) diff --git a/version.go b/version.go index 0e4209d4..d9809404 100644 --- a/version.go +++ b/version.go @@ -5,7 +5,7 @@ import ( "net/http" ) -const version string = "0.1.1" +const version string = "0.1.2" type response struct { Version string