Lint and Vet Fixes

This commit is contained in:
Goutham Veeramachaneni 2017-03-19 21:35:01 +05:30
parent 303a4ec3bc
commit 761e4768f3
No known key found for this signature in database
GPG Key ID: F1C217E8E9023CAD
6 changed files with 13 additions and 7 deletions

View File

@ -15,7 +15,7 @@ import (
)
const (
// MagicSeries 4 bytes at the head of series file.
// MagicChunks is 4 bytes at the head of series file.
MagicChunks = 0x85BD40DD
)

View File

@ -19,6 +19,7 @@ func NewXORChunk() *XORChunk {
return &XORChunk{b: &bstream{stream: b, count: 0}}
}
// Encoding returns the encoding type.
func (c *XORChunk) Encoding() Encoding {
return EncXOR
}

View File

@ -237,21 +237,21 @@ func (b *writeBenchmark) startProfiling() {
// Start CPU profiling.
b.cpuprof, err = os.Create(filepath.Join(b.outPath, "cpu.prof"))
if err != nil {
exitWithError(fmt.Errorf("bench: could not create cpu profile: %v\n", err))
exitWithError(fmt.Errorf("bench: could not create cpu profile: %v", err))
}
pprof.StartCPUProfile(b.cpuprof)
// Start memory profiling.
b.memprof, err = os.Create(filepath.Join(b.outPath, "mem.prof"))
if err != nil {
exitWithError(fmt.Errorf("bench: could not create memory profile: %v\n", err))
exitWithError(fmt.Errorf("bench: could not create memory profile: %v", err))
}
runtime.MemProfileRate = 4096
// Start fatal profiling.
b.blockprof, err = os.Create(filepath.Join(b.outPath, "block.prof"))
if err != nil {
exitWithError(fmt.Errorf("bench: could not create block profile: %v\n", err))
exitWithError(fmt.Errorf("bench: could not create block profile: %v", err))
}
runtime.SetBlockProfileRate(1)
}

View File

@ -23,11 +23,15 @@ type Matcher interface {
Matches(v string) bool
}
// EqualMatcher matches on equality.
type EqualMatcher struct {
name, value string
}
func (m *EqualMatcher) Name() string { return m.name }
// Name implements Matcher interface.
func (m *EqualMatcher) Name() string { return m.name }
// Matches implements Matcher interface.
func (m *EqualMatcher) Matches(v string) bool { return v == m.value }
// NewEqualMatcher returns a new matcher matching an exact label value.

View File

@ -480,7 +480,7 @@ type SeriesIterator interface {
// If there's no value exactly at ts, it advances to the last value
// before tt.
Seek(t int64) bool
// Values returns the current timestamp/value pair.
// At returns the current timestamp/value pair.
At() (t int64, v float64)
// Next advances the iterator by one.
Next() bool
@ -693,7 +693,7 @@ func (b *BufferedSeriesIterator) Next() bool {
return ok
}
// Values returns the current element of the iterator.
// At returns the current element of the iterator.
func (b *BufferedSeriesIterator) At() (int64, float64) {
return b.it.At()
}

1
wal.go
View File

@ -214,6 +214,7 @@ func (w *WAL) tail() *os.File {
return w.files[len(w.files)-1]
}
// Sync flushes the changes to disk.
func (w *WAL) Sync() error {
w.mtx.Lock()
defer w.mtx.Unlock()