pkg/graphdb: some linting

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
unclejack 2014-10-06 22:57:27 +03:00
parent 730301be76
commit 68c42446a1

View file

@ -131,8 +131,8 @@ func (db *Database) Set(fullPath, id string) (*Entity, error) {
if _, err := db.conn.Exec("BEGIN EXCLUSIVE"); err != nil {
return nil, err
}
var entityId string
if err := db.conn.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityId); err != nil {
var entityID string
if err := db.conn.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityID); err != nil {
if err == sql.ErrNoRows {
if _, err := db.conn.Exec("INSERT INTO entity (id) VALUES(?);", id); err != nil {
rollback()
@ -320,14 +320,14 @@ func (db *Database) RefPaths(id string) Edges {
for rows.Next() {
var name string
var parentId string
if err := rows.Scan(&name, &parentId); err != nil {
var parentID string
if err := rows.Scan(&name, &parentID); err != nil {
return refs
}
refs = append(refs, &Edge{
EntityID: id,
Name: name,
ParentID: parentId,
ParentID: parentID,
})
}
return refs
@ -443,11 +443,11 @@ func (db *Database) children(e *Entity, name string, depth int, entities []WalkM
defer rows.Close()
for rows.Next() {
var entityId, entityName string
if err := rows.Scan(&entityId, &entityName); err != nil {
var entityID, entityName string
if err := rows.Scan(&entityID, &entityName); err != nil {
return nil, err
}
child := &Entity{entityId}
child := &Entity{entityID}
edge := &Edge{
ParentID: e.id,
Name: entityName,
@ -490,11 +490,11 @@ func (db *Database) parents(e *Entity) (parents []string, err error) {
defer rows.Close()
for rows.Next() {
var parentId string
if err := rows.Scan(&parentId); err != nil {
var parentID string
if err := rows.Scan(&parentID); err != nil {
return nil, err
}
parents = append(parents, parentId)
parents = append(parents, parentID)
}
return parents, nil