Skip to content

Commit

Permalink
fix go vet report
Browse files Browse the repository at this point in the history
  • Loading branch information
absolute8511 committed Sep 7, 2017
1 parent d184b2d commit 0123096
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/nsq_data_tool/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func main() {
nsqd.NsqLogger().Infof("peeked channel msg : %v", m)
}

cnt, err = delayQ.PeekAll(rets)
cnt, _ = delayQ.PeekAll(rets)
for _, m := range rets[:cnt] {
nsqd.NsqLogger().Infof("peeked msg : %v", m)
}
Expand Down
3 changes: 2 additions & 1 deletion consistence/data_placement_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"container/heap"
"errors"
"fmt"
"github.com/youzan/nsq/nsqd"
"math"
"sort"
"strconv"
"strings"
"sync/atomic"
"time"

"github.com/youzan/nsq/nsqd"
)

// new topic can have an advice load factor to give the suggestion about the
Expand Down
2 changes: 1 addition & 1 deletion consistence/nsqd_node_etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/youzan/nsq/internal/test"
etcdlock "github.com/reechou/xlock2"
"github.com/youzan/nsq/internal/test"
"golang.org/x/net/context"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/http_api/api_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ retry:
}

func (c *Client) POSTV1WithContent(endpoint string, content string) (int, error) {
retry:
retry:
req, err := http.NewRequest("POST", endpoint, strings.NewReader(content))
if err != nil {
return -1, err
Expand Down
13 changes: 10 additions & 3 deletions nsqd/delay_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package nsqd

import (
//"github.com/youzan/nsq/internal/levellogger"
"encoding/json"
"fmt"
"github.com/youzan/nsq/internal/ext"
"github.com/youzan/nsq/internal/test"
"io/ioutil"
"os"
"path"
"testing"
"time"
"encoding/json"

"github.com/youzan/nsq/internal/ext"
"github.com/youzan/nsq/internal/test"
)

func TestDelayQueuePutChannelDelayed(t *testing.T) {
Expand Down Expand Up @@ -158,6 +159,7 @@ func TestDelayQueueEmptyUntil(t *testing.T) {
msg.DelayedChannel = "test2"
msg.DelayedOrigID = MessageID(i + 1)
_, _, _, _, err = dq.PutDelayMessage(msg)
test.Nil(t, err)
time.Sleep(time.Millisecond * 100)
}

Expand All @@ -170,6 +172,7 @@ func TestDelayQueueEmptyUntil(t *testing.T) {
recent, _, _ := dq.GetOldestConsumedState([]string{"test"}, true)
test.Equal(t, 1, len(recent))
_, ts, id, ch, err := decodeDelayedMsgDBKey(recent[0])
test.Nil(t, err)
test.Equal(t, middle.DelayedChannel, ch)
test.Equal(t, middle.ID, id)
test.Equal(t, middle.DelayedTs, ts)
Expand Down Expand Up @@ -215,6 +218,7 @@ func TestDelayQueuePeekRecent(t *testing.T) {
msg.DelayedChannel = "test2"
msg.DelayedOrigID = MessageID(i + 1)
_, _, _, _, err = dq.PutDelayMessage(msg)
test.Nil(t, err)
time.Sleep(time.Millisecond * 100)
}

Expand Down Expand Up @@ -272,6 +276,7 @@ func TestDelayQueueConfirmMsg(t *testing.T) {
msg.DelayedChannel = "test2"
msg.DelayedOrigID = MessageID(i + 1)
_, _, _, _, err = dq.PutDelayMessage(msg)
test.Nil(t, err)
time.Sleep(time.Millisecond * 100)
}

Expand Down Expand Up @@ -381,6 +386,7 @@ func TestDelayQueueBackupRestore(t *testing.T) {
msg.DelayedChannel = "test2"
msg.DelayedOrigID = MessageID(i + 1)
_, _, _, _, err = dq.PutDelayMessage(msg)
test.Nil(t, err)
time.Sleep(time.Millisecond * 100)
}

Expand Down Expand Up @@ -509,6 +515,7 @@ func TestDelayQueueCompactStore(t *testing.T) {
err = dq.compactStore(false)
test.Nil(t, err)
fi2, err = os.Stat(dq.getStore().Path())
test.Nil(t, err)
t.Log(fi)
t.Log(fi2)
afterCompact, _ = dq.GetCurrentDelayedCnt(ChannelDelayed, "test")
Expand Down
1 change: 1 addition & 0 deletions nsqd/nsqd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type errStore struct {
err error
}


var (
ErrTopicPartitionMismatch = errors.New("topic partition mismatch")
ErrTopicNotExist = errors.New("topic does not exist")
Expand Down
7 changes: 4 additions & 3 deletions nsqd/topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"errors"
"os"
//"runtime"
"github.com/absolute8511/glog"
"github.com/youzan/nsq/internal/test"
"path"
"path/filepath"
"strconv"
"testing"
"time"

"github.com/absolute8511/glog"
"github.com/youzan/nsq/internal/test"
)

func TestGetTopic(t *testing.T) {
Expand Down Expand Up @@ -508,7 +509,7 @@ func TestTopicResetWithQueueStart(t *testing.T) {

for i := 0; i < msgNum; i++ {
msg.ID = 0
_, _, msgSize, _, _ = topic.PutMessage(msg)
topic.PutMessage(msg)
}
topic.ForceFlush()
newEnd = topic.backend.GetQueueWriteEnd().(*diskQueueEndInfo)
Expand Down
3 changes: 2 additions & 1 deletion nsqdserver/protocol_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import (
"testing"
"time"

"github.com/golang/snappy"
"github.com/youzan/go-nsq"
"github.com/youzan/nsq/internal/ext"
"github.com/youzan/nsq/internal/levellogger"
"github.com/youzan/nsq/internal/protocol"
"github.com/youzan/nsq/internal/test"
nsqdNs "github.com/youzan/nsq/nsqd"
"github.com/golang/snappy"
)

func identify(t *testing.T, conn io.ReadWriter, extra map[string]interface{}, f int32) []byte {
Expand Down Expand Up @@ -118,6 +118,7 @@ func subFail(t *testing.T, conn io.ReadWriter, topicName string, channelName str
_, err := nsq.Subscribe(topicName, channelName).WriteTo(conn)
test.Equal(t, err, nil)
resp, err := nsq.ReadResponse(conn)
test.Nil(t, err)
frameType, _, _ := nsq.UnpackResponse(resp)
test.Equal(t, frameType, frameTypeError)
}
Expand Down

0 comments on commit 0123096

Please sign in to comment.