Skip to content

Fix mutex passed by value warning #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Graph struct {

// New creates a new graph.
func GraphNew(Id string, conn redis.Conn) Graph {
g := Graph{
return Graph{
Id: Id,
Nodes: make(map[string]*Node, 0),
Edges: make([]*Edge, 0),
Expand All @@ -36,7 +36,6 @@ func GraphNew(Id string, conn redis.Conn) Graph {
relationshipTypes: make([]string, 0),
properties: make([]string, 0),
}
return g
}

// AddNode adds a node to the graph.
Expand Down Expand Up @@ -205,7 +204,7 @@ func (g *Graph) getLabel(lblIdx int) string {
// Retry.
if lblIdx >= len(g.labels) {
// Error!
panic("Unknow label index.")
panic("Unknown label index.")
}
}
g.mutex.Unlock()
Expand All @@ -225,7 +224,7 @@ func (g *Graph) getRelation(relIdx int) string {
// Retry.
if relIdx >= len(g.relationshipTypes) {
// Error!
panic("Unknow relation type index.")
panic("Unknown relation type index.")
}
}
g.mutex.Unlock()
Expand All @@ -246,7 +245,7 @@ func (g *Graph) getProperty(propIdx int) string {
// Retry.
if propIdx >= len(g.properties) {
// Error!
panic("Unknow property index.")
panic("Unknown property index.")
}
}
g.mutex.Unlock()
Expand Down