diff --git a/go/store/datas/commit.go b/go/store/datas/commit.go index 79bfedfabc0..2600c38f52b 100644 --- a/go/store/datas/commit.go +++ b/go/store/datas/commit.go @@ -651,12 +651,12 @@ func GetCommitRootHash(cv types.Value) (hash.Hash, error) { } func parentsToQueue(ctx context.Context, commits []*Commit, q *CommitByHeightHeap, vr types.ValueReader) error { - seen := make(map[hash.Hash]bool) + seen := make(map[hash.Hash]struct{}) for _, c := range commits { if _, ok := seen[c.Addr()]; ok { continue } - seen[c.Addr()] = true + seen[c.Addr()] = struct{}{} parents, err := GetCommitParents(ctx, vr, c.NomsValue()) if err != nil { diff --git a/go/store/nbs/frag/main.go b/go/store/nbs/frag/main.go index e5afb57955b..424259916e7 100644 --- a/go/store/nbs/frag/main.go +++ b/go/store/nbs/frag/main.go @@ -109,7 +109,7 @@ func main() { chartFmt := "| %6d | %7d | %8d | %9d | %6d | %5d | %6d |\n" var optimal, sum int - visited := map[hash.Hash]bool{} + visited := make(map[hash.Hash]struct{}) current := hash.HashSlice{root} for numNodes := 1; numNodes > 0; numNodes = len(current) { @@ -120,7 +120,7 @@ func main() { for i, v := range readValues { h := current[i] currentValues[h] = v - visited[h] = true + visited[h] = struct{}{} } // Iterate all the Values at the current level of the graph IN ORDER (as specified in |current|) and gather up their embedded refs. We'll build two different lists of hash.Hashes during this process: @@ -132,7 +132,7 @@ func main() { for _, h := range current { _ = types.WalkAddrs(currentValues[h], types.Format_Default, func(h hash.Hash, isleaf bool) error { orderedChildren = append(orderedChildren, h) - if !visited[h] && !isleaf { + if _, ok := visited[h]; !ok && !isleaf { nextLevel = append(nextLevel, h) } return nil diff --git a/go/store/nbs/util.go b/go/store/nbs/util.go index 1fff4091559..32c864cfa36 100644 --- a/go/store/nbs/util.go +++ b/go/store/nbs/util.go @@ -33,7 +33,7 @@ func IterChunks(ctx context.Context, rd io.ReadSeeker, cb func(chunk chunks.Chun defer idx.Close() - seen := make(map[hash.Hash]bool) + seen := make(map[hash.Hash]struct{}) for i := uint32(0); i < idx.chunkCount(); i++ { var h hash.Hash ie, err := idx.indexEntry(i, &h) @@ -41,7 +41,7 @@ func IterChunks(ctx context.Context, rd io.ReadSeeker, cb func(chunk chunks.Chun return err } if _, ok := seen[h]; !ok { - seen[h] = true + seen[h] = struct{}{} chunkBytes, err := readNFrom(rd, ie.Offset(), ie.Length()) if err != nil { return err