Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

minor go lint fixes (#237)

Guilherme Oenningff372069a99d
diff --git a/app/pkg/jsonq/jsonq.go b/app/pkg/jsonq/jsonq.go
index 3afabeefd..4f0e8f4f5 100644
--- a/app/pkg/jsonq/jsonq.go
+++ b/app/pkg/jsonq/jsonq.go
@@ -5,10 +5,12 @@ import (
"strings"
)
+//Query is a JSON query interface
type Query struct {
m map[string]*json.RawMessage
}
+//New creates a new Query object based on given input as a JSON
func New(content string) *Query {
var m map[string]*json.RawMessage
err := json.Unmarshal([]byte(content), &m)
@@ -18,6 +20,7 @@ func New(content string) *Query {
return &Query{m: m}
}
+//String returns a string value from the json object based on its key
func (q *Query) String(key string) (string, error) {
data := q.get(key)
if data != nil {
@@ -28,6 +31,7 @@ func (q *Query) String(key string) (string, error) {
return "", nil
}
+//Contains returns true if the json object has the key
func (q *Query) Contains(key string) bool {
return q.get(key) != nil
}
diff --git a/app/pkg/uuid/uuid.go b/app/pkg/uuid/uuid.go
index 295f3fc2c..f14fa94e1 100644
--- a/app/pkg/uuid/uuid.go
+++ b/app/pkg/uuid/uuid.go
@@ -134,7 +134,7 @@ type NullUUID struct {
Valid bool
}
-// The nil UUID is special form of UUID that is specified to have all
+// Nil is the nil UUID is special form of UUID that is specified to have all
// 128 bits set to zero.
var Nil = UUID{}
diff --git a/app/pkg/web/engine.go b/app/pkg/web/engine.go
index 9393b9cf6..80866d148 100644
--- a/app/pkg/web/engine.go
+++ b/app/pkg/web/engine.go
@@ -58,9 +58,12 @@ func (e *Engine) Start(address string) {
ErrorLog: stdLog.New(e.logger, "", 0),
}
- var err error
+ var (
+ err error
+ certManager *CertificateManager
+ )
if autoSSL == "true" {
- certManager, err := NewCertificateManager(certFile, keyFile, "certs")
+ certManager, err = NewCertificateManager(certFile, keyFile, "certs")
if err != nil {
panic(err)
}
diff --git a/app/storage/postgres/user_test.go b/app/storage/postgres/user_test.go
index e3cb22e12..6a5ace9f6 100644
--- a/app/storage/postgres/user_test.go
+++ b/app/storage/postgres/user_test.go
@@ -200,6 +200,7 @@ func TestUserStorage_UpdateSettings(t *testing.T) {
Expect(err).To(BeNil())
user, err := users.GetByEmail(1, "[email protected]")
+ Expect(err).To(BeNil())
Expect(user.Name).To(Equal("Jon Stark"))
}
@@ -212,6 +213,7 @@ func TestUserStorage_ChangeRole(t *testing.T) {
Expect(err).To(BeNil())
user, err := users.GetByEmail(1, "[email protected]")
+ Expect(err).To(BeNil())
Expect(user.Role).To(Equal(models.RoleVisitor))
}