提交 ca89ece5 编写于 作者: Q quicksilver 提交者: yefu.chen

Fix go format bug

Signed-off-by: Nquicksilver <zhifeng.zhang@zilliz.com>
上级 8b39643e
#! /bin/bash
export GO_DIFF_FILES=$(git diff --name-only --diff-filter=d HEAD "*.go")
GO_DIFF_FILES=""
while read -r line; do
export GO_DIFF_FILES="$GO_DIFF_FILES $line"
done <<< "$(git diff --name-only --diff-filter=d HEAD "*.go")"
make fmt
......@@ -181,7 +181,7 @@ func CreateServer(ctx context.Context) (*Master, error) {
m.scheduler.SetDDMsgStream(pulsarDDStream)
m.scheduler.SetIDAllocator(func() (UniqueID, error) { return m.idAllocator.AllocOne() })
flushClient, err := writerclient.NewWriterClient(Params.EtcdAddress, Params.MetaRootPath, Params.WriteNodeSegKvSubPath, pulsarDDStream)
flushClient, err := writerclient.NewWriterClient(Params.EtcdAddress, kvRootPath, Params.WriteNodeSegKvSubPath, pulsarDDStream)
if err != nil {
return nil, err
}
......
......@@ -310,28 +310,32 @@ func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, r
switch eventType {
case CreateCollectionEventType:
var req internalpb.CreateCollectionRequest
if err := proto.UnmarshalText(val, &req); err != nil {
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err
}
fmt.Printf("\t\t%d : create collection: %v\n", i, req)
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : create collection: %s\n", i, msg)
case DropCollectionEventType:
var req internalpb.DropCollectionRequest
if err := proto.UnmarshalText(val, &req); err != nil {
var req internalpb.DropPartitionRequest
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err
}
fmt.Printf("\t\t%d : drop collection: %v\n", i, req)
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : drop collection: %s\n", i, msg)
case CreatePartitionEventType:
var req internalpb.CreatePartitionRequest
if err := proto.UnmarshalText(val, &req); err != nil {
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err
}
fmt.Printf("\t\t%d : create partition: %v\n", i, req)
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : create partition: %s\n", i, msg)
case DropPartitionEventType:
var req internalpb.DropPartitionRequest
if err := proto.UnmarshalText(val, &req); err != nil {
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err
}
fmt.Printf("\t\t%d : drop partition: %v\n", i, req)
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : drop partition: %s\n", i, msg)
default:
return errors.Errorf("undefined ddl event type %d", eventType)
}
......
......@@ -542,21 +542,15 @@ func (ibNode *insertBufferNode) getMeta(segID UniqueID) (*etcdpb.SegmentMeta, *e
segMeta := &etcdpb.SegmentMeta{}
key := path.Join(SegmentPrefix, strconv.FormatInt(segID, 10))
value, err := ibNode.kvClient.Load(key)
if err != nil {
return nil, nil, err
}
err = proto.UnmarshalText(value, segMeta)
value, _ := ibNode.kvClient.Load(key)
err := proto.UnmarshalText(value, segMeta)
if err != nil {
return nil, nil, err
}
collMeta := &etcdpb.CollectionMeta{}
key = path.Join(CollectionPrefix, strconv.FormatInt(segMeta.GetCollectionID(), 10))
value, err = ibNode.kvClient.Load(key)
if err != nil {
return nil, nil, err
}
value, _ = ibNode.kvClient.Load(key)
err = proto.UnmarshalText(value, collMeta)
if err != nil {
return nil, nil, err
......
......@@ -13,13 +13,16 @@ function bred(){
files=()
files_need_gofmt=()
if [ -f "$1" ];then
files+=("$1")
fi
if [ -d "$1" ];then
for file in `find $1 -type f | grep "\.go$"`; do
files+=("$file")
if [[ $# -ne 0 ]]; then
for arg in "$@"; do
if [ -f "$arg" ];then
files+=("$arg")
fi
if [ -d "$arg" ];then
for file in `find $arg -type f | grep "\.go$"`; do
files+=("$file")
done
fi
done
fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册