Merge branch 'master' into 1511-metalinter-interfacer

This commit is contained in:
Cody Soyland 2018-07-17 13:41:11 -05:00
commit 486edbec43
24 changed files with 70 additions and 70 deletions

View file

@ -109,7 +109,7 @@ docker-test:
docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) golang:$(GO_VERSION) go test -tags='$(BUILD_TAGS)' $(TESTFLAGS) ./...
metalinter:
gometalinter --vendor --disable-all --enable=gotype --enable=gotypex --enable=gofmt --enable=goimports --enable=interfacer --deadline=60s --exclude "^internal/.*\.pb\.go" ./...
gometalinter --vendor --disable-all --enable=gotype --enable=gotypex --enable=gofmt --enable=goimports --enable=interfacer --enable=misspell --enable=unparam --deadline=60s --exclude "^internal/.*\.pb\.go" ./...
######################
# Build dependencies #

58
api.go
View file

@ -174,7 +174,7 @@ func (api *API) readColumnAttrSets(index *Index, ids []uint64) ([]*ColumnAttrSet
}
// CreateIndex makes a new Pilosa index.
func (api *API) CreateIndex(ctx context.Context, indexName string, options IndexOptions) (*Index, error) {
func (api *API) CreateIndex(_ context.Context, indexName string, options IndexOptions) (*Index, error) {
if err := api.validate(apiCreateIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -198,7 +198,7 @@ func (api *API) CreateIndex(ctx context.Context, indexName string, options Index
}
// Index retrieves the named index.
func (api *API) Index(ctx context.Context, indexName string) (*Index, error) {
func (api *API) Index(_ context.Context, indexName string) (*Index, error) {
if err := api.validate(apiIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -212,7 +212,7 @@ func (api *API) Index(ctx context.Context, indexName string) (*Index, error) {
// DeleteIndex removes the named index. If the index is not found it does
// nothing and returns no error.
func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
func (api *API) DeleteIndex(_ context.Context, indexName string) error {
if err := api.validate(apiDeleteIndex); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -238,7 +238,7 @@ func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
// CreateField makes the named field in the named index with the given options.
// This method currently only takes a single functional option, but that may be
// changed in the future to support multiple options.
func (api *API) CreateField(ctx context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) {
func (api *API) CreateField(_ context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) {
if err := api.validate(apiCreateField); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -280,7 +280,7 @@ func (api *API) CreateField(ctx context.Context, indexName string, fieldName str
}
// Field retrieves the named field.
func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, error) {
func (api *API) Field(_ context.Context, indexName, fieldName string) (*Field, error) {
if err := api.validate(apiField); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -295,7 +295,7 @@ func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field,
// DeleteField removes the named field from the named index. If the index is not
// found, an error is returned. If the field is not found, it is ignored and no
// action is taken.
func (api *API) DeleteField(ctx context.Context, indexName string, fieldName string) error {
func (api *API) DeleteField(_ context.Context, indexName string, fieldName string) error {
if err := api.validate(apiDeleteField); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -327,7 +327,7 @@ func (api *API) DeleteField(ctx context.Context, indexName string, fieldName str
// ExportCSV encodes the fragment designated by the index,field,shard as
// CSV of the form <row>,<col>
func (api *API) ExportCSV(ctx context.Context, indexName string, fieldName string, shard uint64, w io.Writer) error {
func (api *API) ExportCSV(_ context.Context, indexName string, fieldName string, shard uint64, w io.Writer) error {
if err := api.validate(apiExportCSV); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -364,7 +364,7 @@ func (api *API) ExportCSV(ctx context.Context, indexName string, fieldName strin
}
// ShardNodes returns the node and all replicas which should contain a shard's data.
func (api *API) ShardNodes(ctx context.Context, indexName string, shard uint64) ([]*Node, error) {
func (api *API) ShardNodes(_ context.Context, indexName string, shard uint64) ([]*Node, error) {
if err := api.validate(apiShardNodes); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -375,7 +375,7 @@ func (api *API) ShardNodes(ctx context.Context, indexName string, shard uint64)
// FragmentBlockData is an endpoint for internal usage. It is not guaranteed to
// return anything useful. Currently it returns protobuf encoded row and column
// ids from a "block" which is a subdivision of a fragment.
func (api *API) FragmentBlockData(ctx context.Context, body io.Reader) ([]byte, error) {
func (api *API) FragmentBlockData(_ context.Context, body io.Reader) ([]byte, error) {
if err := api.validate(apiFragmentBlockData); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -408,7 +408,7 @@ func (api *API) FragmentBlockData(ctx context.Context, body io.Reader) ([]byte,
}
// FragmentBlocks returns the checksums and block ids for all blocks in the specified fragment.
func (api *API) FragmentBlocks(ctx context.Context, indexName string, fieldName string, shard uint64) ([]FragmentBlock, error) {
func (api *API) FragmentBlocks(_ context.Context, indexName string, fieldName string, shard uint64) ([]FragmentBlock, error) {
if err := api.validate(apiFragmentBlocks); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -426,7 +426,7 @@ func (api *API) FragmentBlocks(ctx context.Context, indexName string, fieldName
// Hosts returns a list of the hosts in the cluster including their ID,
// URL, and which is the coordinator.
func (api *API) Hosts(ctx context.Context) []*Node {
func (api *API) Hosts(_ context.Context) []*Node {
return api.cluster.Nodes
}
@ -437,7 +437,7 @@ func (api *API) Node() *Node {
}
// RecalculateCaches forces all TopN caches to be updated. Used mainly for integration tests.
func (api *API) RecalculateCaches(ctx context.Context) error {
func (api *API) RecalculateCaches(_ context.Context) error {
if err := api.validate(apiRecalculateCaches); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -452,7 +452,7 @@ func (api *API) RecalculateCaches(ctx context.Context) error {
// PostClusterMessage is for internal use. It decodes a protobuf message out of
// the body and forwards it to the BroadcastHandler.
func (api *API) ClusterMessage(ctx context.Context, reqBody io.Reader) error {
func (api *API) ClusterMessage(_ context.Context, reqBody io.Reader) error {
if err := api.validate(apiClusterMessage); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -479,12 +479,12 @@ func (api *API) ClusterMessage(ctx context.Context, reqBody io.Reader) error {
// Schema returns information about each index in Pilosa including which fields
// they contain.
func (api *API) Schema(ctx context.Context) []*IndexInfo {
func (api *API) Schema(_ context.Context) []*IndexInfo {
return api.holder.limitedSchema()
}
// Views returns the views in the given field.
func (api *API) Views(ctx context.Context, indexName string, fieldName string) ([]*view, error) {
func (api *API) Views(_ context.Context, indexName string, fieldName string) ([]*view, error) {
if err := api.validate(apiViews); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -501,7 +501,7 @@ func (api *API) Views(ctx context.Context, indexName string, fieldName string) (
}
// DeleteView removes the given view.
func (api *API) DeleteView(ctx context.Context, indexName string, fieldName string, viewName string) error {
func (api *API) DeleteView(_ context.Context, indexName string, fieldName string, viewName string) error {
if err := api.validate(apiDeleteView); err != nil {
return errors.Wrap(err, "validating api method")
}
@ -535,7 +535,7 @@ func (api *API) DeleteView(ctx context.Context, indexName string, fieldName stri
}
// IndexAttrDiff
func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
func (api *API) IndexAttrDiff(_ context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
if err := api.validate(apiIndexAttrDiff); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -569,7 +569,7 @@ func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []At
return attrs, nil
}
func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
func (api *API) FieldAttrDiff(_ context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
if err := api.validate(apiFieldAttrDiff); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
@ -604,12 +604,12 @@ func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName s
}
// Import bulk imports data into a particular index,field,shard.
func (api *API) Import(ctx context.Context, req *ImportRequest) error {
func (api *API) Import(_ context.Context, req *ImportRequest) error {
if err := api.validate(apiImport); err != nil {
return errors.Wrap(err, "validating api method")
}
_, field, err := api.indexField(req.Index, req.Field, req.Shard)
field, err := api.indexField(req.Index, req.Field, req.Shard)
if err != nil {
return errors.Wrap(err, "getting field")
}
@ -633,12 +633,12 @@ func (api *API) Import(ctx context.Context, req *ImportRequest) error {
}
// ImportValue bulk imports values into a particular field.
func (api *API) ImportValue(ctx context.Context, req *ImportValueRequest) error {
func (api *API) ImportValue(_ context.Context, req *ImportValueRequest) error {
if err := api.validate(apiImportValue); err != nil {
return errors.Wrap(err, "validating api method")
}
_, field, err := api.indexField(req.Index, req.Field, req.Shard)
field, err := api.indexField(req.Index, req.Field, req.Shard)
if err != nil {
return errors.Wrap(err, "getting field")
}
@ -651,7 +651,7 @@ func (api *API) ImportValue(ctx context.Context, req *ImportValueRequest) error
}
// MaxShards returns the maximum shard number for each index in a map.
func (api *API) MaxShards(ctx context.Context) map[string]uint64 {
func (api *API) MaxShards(_ context.Context) map[string]uint64 {
return api.holder.maxShards()
}
@ -673,11 +673,11 @@ func (api *API) LongQueryTime() time.Duration {
return api.cluster.longQueryTime
}
func (api *API) indexField(indexName string, fieldName string, shard uint64) (*Index, *Field, error) {
func (api *API) indexField(indexName string, fieldName string, shard uint64) (*Field, error) {
// Validate that this handler owns the shard.
if !api.cluster.ownsShard(api.Node().ID, indexName, shard) {
api.server.logger.Printf("node %s does not own shard %d of index %s", api.Node().ID, shard, indexName)
return nil, nil, ErrClusterDoesNotOwnShard
return nil, ErrClusterDoesNotOwnShard
}
// Find the Index.
@ -685,20 +685,20 @@ func (api *API) indexField(indexName string, fieldName string, shard uint64) (*I
index := api.holder.Index(indexName)
if index == nil {
api.server.logger.Printf("fragment error: index=%s, field=%s, shard=%d, err=%s", indexName, fieldName, shard, ErrIndexNotFound.Error())
return nil, nil, newNotFoundError(ErrIndexNotFound)
return nil, newNotFoundError(ErrIndexNotFound)
}
// Retrieve field.
field := index.Field(fieldName)
if field == nil {
api.server.logger.Printf("field error: index=%s, field=%s, shard=%d, err=%s", indexName, fieldName, shard, ErrFieldNotFound.Error())
return nil, nil, ErrFieldNotFound
return nil, ErrFieldNotFound
}
return index, field, nil
return field, nil
}
// SetCoordinator makes a new Node the cluster coordinator.
func (api *API) SetCoordinator(ctx context.Context, id string) (oldNode, newNode *Node, err error) {
func (api *API) SetCoordinator(_ context.Context, id string) (oldNode, newNode *Node, err error) {
if err := api.validate(apiSetCoordinator); err != nil {
return nil, nil, errors.Wrap(err, "validating api method")
}

View file

@ -46,7 +46,7 @@ type AttrStore interface {
var nopStore AttrStore = nopAttrStore{}
// newNopAttrStore returns an attr store which does nothing. It returns a global
// object to avoid unecessary allocations.
// object to avoid unnecessary allocations.
func newNopAttrStore(string) AttrStore { return nopStore }
// nopAttrStore represents a no-op implementation of the AttrStore interface.

View file

@ -412,7 +412,7 @@ type blockCursor struct {
}
// newBlockCursor returns a new block cursor that wraps cur using n sized blocks.
func newBlockCursor(c *bolt.Cursor, n int) blockCursor {
func newBlockCursor(c *bolt.Cursor, n int) blockCursor { // nolint: unparam
cur := blockCursor{
cur: c,
n: uint64(n),

View file

@ -5,7 +5,7 @@ import (
"io"
)
// Bit represents the intersection of a row and a column. It can be specifed by
// Bit represents the intersection of a row and a column. It can be specified by
// integer ids or string keys.
type Bit struct {
RowID uint64

View file

@ -282,7 +282,7 @@ func (c *cluster) setCoordinator(n *Node) error {
// changing the corresponding node's IsCoordinator value
// to true, and sets all other nodes to false. Returns true if the value
// changed.
func (c *cluster) updateCoordinator(n *Node) bool {
func (c *cluster) updateCoordinator(n *Node) bool { // nolint: unparam
c.mu.Lock()
defer c.mu.Unlock()
return c.unprotectedUpdateCoordinator(n)
@ -416,7 +416,7 @@ func (c *cluster) setState(state string) {
}
}
func (c *cluster) setNodeState(state string) error {
func (c *cluster) setNodeState(state string) error { // nolint: unparam
if c.isCoordinator() {
return c.receiveNodeState(c.Node.ID, state)
}

View file

@ -86,7 +86,7 @@ Build Time: ` + pilosa.BuildTime + "\n",
// setAllConfig looks for environment variables which are capitalized versions
// of the flag names with dashes replaced by underscores, and prefixed with
// envPrefix plus an underscore.
func setAllConfig(v *viper.Viper, flags *pflag.FlagSet, envPrefix string) error {
func setAllConfig(v *viper.Viper, flags *pflag.FlagSet, envPrefix string) error { // nolint: unparam
// add cmd line flag def to viper
err := v.BindPFlags(flags)
if err != nil {

View file

@ -44,7 +44,7 @@ func NewCheckCommand(stdin io.Reader, stdout, stderr io.Writer) *CheckCommand {
}
// Run executes the check command.
func (cmd *CheckCommand) Run(ctx context.Context) error {
func (cmd *CheckCommand) Run(_ context.Context) error {
for _, path := range cmd.Paths {
switch filepath.Ext(path) {
case "":

View file

@ -38,7 +38,7 @@ func NewConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *ConfigCommand
}
// Run prints out the default config.
func (cmd *ConfigCommand) Run(ctx context.Context) error {
func (cmd *ConfigCommand) Run(_ context.Context) error {
buf, err := toml.Marshal(*cmd.Config)
if err != nil {
return err

View file

@ -38,7 +38,7 @@ func NewGenerateConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *Genera
}
// Run prints out the default config.
func (cmd *GenerateConfigCommand) Run(ctx context.Context) error {
func (cmd *GenerateConfigCommand) Run(_ context.Context) error {
conf := server.NewConfig()
ret, err := toml.Marshal(*conf)
if err != nil {

View file

@ -46,7 +46,7 @@ func NewInspectCommand(stdin io.Reader, stdout, stderr io.Writer) *InspectComman
}
// Run executes the inspect command.
func (cmd *InspectCommand) Run(ctx context.Context) error {
func (cmd *InspectCommand) Run(_ context.Context) error {
// Open file handle.
f, err := os.Open(cmd.Path)
if err != nil {

View file

@ -57,7 +57,7 @@ type diagnosticsCollector struct {
}
// newDiagnosticsCollector returns a new DiagnosticsCollector given an addr in the format "hostname:port".
func newDiagnosticsCollector(host string) *diagnosticsCollector {
func newDiagnosticsCollector(host string) *diagnosticsCollector { // nolint: unparam
return &diagnosticsCollector{
host: host,
VersionURL: defaultVersionCheckURL,

View file

@ -494,7 +494,7 @@ func (t *tree) overflow(p *x, q *d, pi, i int, k uint64, v *roaring.Container) {
// data items up to the index of the new data item.
if l != nil && l.c < 2*kd && i != 0 {
s := (2*kd-l.c)/2 + 1 // half plus one
//s := 2*kd - l.c // all avaiable
//s := 2*kd - l.c // all available
if i < s {
s = i
}

View file

@ -665,7 +665,7 @@ func (e *executor) executeDifferenceShard(ctx context.Context, index string, c *
return other, nil
}
func (e *executor) executeBitmapShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
func (e *executor) executeBitmapShard(_ context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
// Fetch column label from index.
idx := e.Holder.Index(index)
if idx == nil {
@ -793,7 +793,7 @@ func (e *executor) executeRangeShard(ctx context.Context, index string, c *pql.C
}
// executeBSIGroupRangeShard executes a range(bsiGroup) call for a local shard.
func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
func (e *executor) executeBSIGroupRangeShard(_ context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
// Only one conditional should be present.
if len(c.Args) == 0 {
return nil, errors.New("Range(): condition required")
@ -1048,7 +1048,7 @@ func (e *executor) executeClearBitField(ctx context.Context, index string, c *pq
}
// Forward call to remote node otherwise.
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, opt); err != nil {
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil); err != nil {
return false, err
} else {
ret = res[0].(bool)
@ -1140,7 +1140,7 @@ func (e *executor) executeSetBitField(ctx context.Context, index string, c *pql.
}
// Forward call to remote node otherwise.
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, opt); err != nil {
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil); err != nil {
return false, err
} else {
ret = res[0].(bool)
@ -1172,7 +1172,7 @@ func (e *executor) executeSetValueField(ctx context.Context, index string, c *pq
}
// Forward call to remote node otherwise.
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, opt); err != nil {
if res, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil); err != nil {
return false, err
} else {
ret = res[0].(bool)
@ -1223,7 +1223,7 @@ func (e *executor) executeSetRowAttrs(ctx context.Context, index string, c *pql.
resp := make(chan error, len(nodes))
for _, node := range nodes {
go func(node *Node) {
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, opt)
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil)
resp <- err
}(node)
}
@ -1309,7 +1309,7 @@ func (e *executor) executeBulkSetRowAttrs(ctx context.Context, index string, cal
resp := make(chan error, len(nodes))
for _, node := range nodes {
go func(node *Node) {
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: calls}, nil, opt)
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: calls}, nil)
resp <- err
}(node)
}
@ -1358,7 +1358,7 @@ func (e *executor) executeSetColumnAttrs(ctx context.Context, index string, c *p
resp := make(chan error, len(nodes))
for _, node := range nodes {
go func(node *Node) {
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil, opt)
_, err := e.remoteExec(ctx, node, index, &pql.Query{Calls: []*pql.Call{c}}, nil)
resp <- err
}(node)
}
@ -1373,8 +1373,8 @@ func (e *executor) executeSetColumnAttrs(ctx context.Context, index string, c *p
return nil
}
// exec executes a PQL query remotely for a set of shards on a node.
func (e *executor) remoteExec(ctx context.Context, node *Node, index string, q *pql.Query, shards []uint64, opt *execOptions) (results []interface{}, err error) { // nolint: interfacer
// remoteExec executes a PQL query remotely for a set of shards on a node.
func (e *executor) remoteExec(ctx context.Context, node *Node, index string, q *pql.Query, shards []uint64) (results []interface{}, err error) { // nolint: interfacer
// Encode request object.
pbreq := &QueryRequest{
Query: q.String(),
@ -1487,7 +1487,7 @@ func (e *executor) mapper(ctx context.Context, ch chan mapResponse, nodes []*Nod
if n.ID == e.Node.ID {
resp.result, resp.err = e.mapperLocal(ctx, nodeShards, mapFn, reduceFn)
} else if !opt.Remote {
results, err := e.remoteExec(ctx, n, index, &pql.Query{Calls: []*pql.Call{c}}, nodeShards, opt)
results, err := e.remoteExec(ctx, n, index, &pql.Query{Calls: []*pql.Call{c}}, nodeShards)
if len(results) > 0 {
resp.result = results[0]
}

View file

@ -520,7 +520,7 @@ func (f *fragment) setValue(columnID uint64, bitDepth uint, value uint64) (chang
}
// importSetValue is a more efficient SetValue just for imports.
func (f *fragment) importSetValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) {
func (f *fragment) importSetValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) { // nolint: unparam
for i := uint(0); i < bitDepth; i++ {
if value&(1<<i) != 0 {
@ -1903,7 +1903,7 @@ func (s *fragmentSyncer) syncBlock(id int) error {
return nil
}
func madvise(b []byte, advice int) (err error) {
func madvise(b []byte, advice int) (err error) { // nolint: unparam
_, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice))
if e1 != 0 {
err = e1

View file

@ -114,7 +114,7 @@ func (g *memberSet) joinWithRetry(hosts []string) error {
}
// retry periodically retries function fn a specified number of attempts.
func retry(attempts int, sleep time.Duration, fn func() error) (err error) {
func retry(attempts int, sleep time.Duration, fn func() error) (err error) { // nolint: unparam
for i := 0; ; i++ {
err = fn()
if err == nil {

View file

@ -247,7 +247,7 @@ func newRouter(handler *Handler) *mux.Router {
return router
}
func (h *Handler) methodNotAllowedHandler(w http.ResponseWriter, r *http.Request) {
func (h *Handler) methodNotAllowedHandler(w http.ResponseWriter, _ *http.Request) {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
}
@ -347,7 +347,7 @@ func (r *successResponse) write(w http.ResponseWriter, err error) {
}
}
func (h *Handler) handleHome(w http.ResponseWriter, r *http.Request) {
func (h *Handler) handleHome(w http.ResponseWriter, _ *http.Request) {
http.Error(w, "Welcome. Pilosa is running. Visit https://www.pilosa.com/docs/ for more information.", http.StatusNotFound)
}

View file

@ -100,7 +100,7 @@ func Xor(args ...*pql.Call) *pql.Call {
return &pql.Call{Name: "Xor", Args: kvargs, Children: children}
}
func Between(frame string, min, max int) *pql.Call {
func Between(_ string, min, max int) *pql.Call {
return &pql.Call{
Name: "Range",
Args: Args{
@ -109,7 +109,7 @@ func Between(frame string, min, max int) *pql.Call {
},
}
}
func Lt(frame string, column int) *pql.Call {
func Lt(_ string, column int) *pql.Call {
return &pql.Call{
Name: "Range",
Args: Args{
@ -118,7 +118,7 @@ func Lt(frame string, column int) *pql.Call {
},
}
}
func Lte(frame string, column int) *pql.Call {
func Lte(_ string, column int) *pql.Call {
return &pql.Call{
Name: "Range",
Args: Args{
@ -127,7 +127,7 @@ func Lte(frame string, column int) *pql.Call {
},
}
}
func Gt(frame string, column int) *pql.Call {
func Gt(_ string, column int) *pql.Call {
return &pql.Call{
Name: "Range",
Args: Args{
@ -137,7 +137,7 @@ func Gt(frame string, column int) *pql.Call {
}
}
func Gte(frame string, column int) *pql.Call {
func Gte(_ string, column int) *pql.Call {
return &pql.Call{
Name: "Range",
Args: Args{

View file

@ -88,7 +88,7 @@ type limitIterator struct {
}
// newLimitIterator returns a new LimitIterator.
func newLimitIterator(itr iterator, maxRowID, maxColumnID uint64) *limitIterator {
func newLimitIterator(itr iterator, maxRowID, maxColumnID uint64) *limitIterator { // nolint: unparam
return &limitIterator{
itr: itr,
maxRowID: maxRowID,

View file

@ -25,7 +25,7 @@ type Cache struct {
// an item is evicted. Zero means no limit.
maxEntries int
// OnEvicted optionally specificies a callback function to be
// OnEvicted optionally specifies a callback function to be
// executed when an entry is purged from the cache.
OnEvicted func(key Key, value interface{})

2
row.go
View file

@ -160,7 +160,7 @@ func (r *Row) SetBit(i uint64) (changed bool) {
}
// clearBit clears the i-th column of the row.
func (r *Row) clearBit(i uint64) (changed bool) {
func (r *Row) clearBit(i uint64) (changed bool) { // nolint: unparam
s := r.segment(i / ShardWidth)
if s == nil {
return false

View file

@ -50,7 +50,7 @@ func mustOpenField(opts pilosa.FieldOption) *Field {
}
// close closes the field and removes the underlying data.
func (f *Field) close() error {
func (f *Field) close() error { // nolint: unparam
defer os.RemoveAll(f.Path())
return f.Field.Close()
}

View file

@ -87,7 +87,7 @@ func viewByTimeUnit(name string, t time.Time, unit rune) string {
}
// viewsByTime returns a list of views for a given timestamp.
func viewsByTime(name string, t time.Time, q TimeQuantum) []string {
func viewsByTime(name string, t time.Time, q TimeQuantum) []string { // nolint: unparam
a := make([]string, 0, len(q))
for _, unit := range q {
view := viewByTimeUnit(name, t, unit)
@ -100,7 +100,7 @@ func viewsByTime(name string, t time.Time, q TimeQuantum) []string {
}
// viewsByTimeRange returns a list of views to traverse to query a time range.
func viewsByTimeRange(name string, start, end time.Time, q TimeQuantum) []string {
func viewsByTimeRange(name string, start, end time.Time, q TimeQuantum) []string { // nolint: unparam
t := start
// Save flags for performance.

View file

@ -889,7 +889,7 @@ func hashKey(key []byte) uint64 {
return h
}
func pow2(v uint64) uint64 {
func pow2(v uint64) uint64 { // nolint: unparam
for i := uint64(2); i < 1<<62; i *= 2 {
if i >= v {
return i