Skip to content
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

Fix function comments based on best practices from Effective Go #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/bolt/cmd/bolt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,15 +1295,15 @@ type BenchResults struct {
ReadDuration time.Duration
}

// Returns the duration for a single write operation.
// WriteOpDuration returns the duration for a single write operation.
func (r *BenchResults) WriteOpDuration() time.Duration {
if r.WriteOps == 0 {
return 0
}
return r.WriteDuration / time.Duration(r.WriteOps)
}

// Returns average number of write operations that can be performed per second.
// WriteOpsPerSecond returns average number of write operations that can be performed per second.
func (r *BenchResults) WriteOpsPerSecond() int {
var op = r.WriteOpDuration()
if op == 0 {
Expand All @@ -1312,15 +1312,15 @@ func (r *BenchResults) WriteOpsPerSecond() int {
return int(time.Second) / int(op)
}

// Returns the duration for a single read operation.
// ReadOpDuration returns the duration for a single read operation.
func (r *BenchResults) ReadOpDuration() time.Duration {
if r.ReadOps == 0 {
return 0
}
return r.ReadDuration / time.Duration(r.ReadOps)
}

// Returns average number of read operations that can be performed per second.
// ReadOpsPerSecond returns average number of read operations that can be performed per second.
func (r *BenchResults) ReadOpsPerSecond() int {
var op = r.ReadOpDuration()
if op == 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/bolt/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ func (db *DB) Stats() Stats {
return db.stats
}

// This is for internal access to the raw data bytes from the C cursor, use
// Info is for internal access to the raw data bytes from the C cursor, use
// carefully, or not at all.
func (db *DB) Info() *Info {
return &Info{uintptr(unsafe.Pointer(&db.data[0])), db.pageSize}
Expand Down