Fix go format bug

Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
This commit is contained in:
quicksilver 2021-01-05 14:20:45 +08:00 committed by yefu.chen
parent 8b39643e44
commit ca89ece576
5 changed files with 32 additions and 27 deletions

View File

@ -1,5 +1,9 @@
#! /bin/bash #! /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 make fmt

View File

@ -181,7 +181,7 @@ func CreateServer(ctx context.Context) (*Master, error) {
m.scheduler.SetDDMsgStream(pulsarDDStream) m.scheduler.SetDDMsgStream(pulsarDDStream)
m.scheduler.SetIDAllocator(func() (UniqueID, error) { return m.idAllocator.AllocOne() }) 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 { if err != nil {
return nil, err return nil, err
} }

View File

@ -310,28 +310,32 @@ func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, r
switch eventType { switch eventType {
case CreateCollectionEventType: case CreateCollectionEventType:
var req internalpb.CreateCollectionRequest var req internalpb.CreateCollectionRequest
if err := proto.UnmarshalText(val, &req); err != nil { if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err 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: case DropCollectionEventType:
var req internalpb.DropCollectionRequest var req internalpb.DropPartitionRequest
if err := proto.UnmarshalText(val, &req); err != nil { if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err 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: case CreatePartitionEventType:
var req internalpb.CreatePartitionRequest var req internalpb.CreatePartitionRequest
if err := proto.UnmarshalText(val, &req); err != nil { if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err 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: case DropPartitionEventType:
var req internalpb.DropPartitionRequest var req internalpb.DropPartitionRequest
if err := proto.UnmarshalText(val, &req); err != nil { if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
return err 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: default:
return errors.Errorf("undefined ddl event type %d", eventType) return errors.Errorf("undefined ddl event type %d", eventType)
} }

View File

@ -542,21 +542,15 @@ func (ibNode *insertBufferNode) getMeta(segID UniqueID) (*etcdpb.SegmentMeta, *e
segMeta := &etcdpb.SegmentMeta{} segMeta := &etcdpb.SegmentMeta{}
key := path.Join(SegmentPrefix, strconv.FormatInt(segID, 10)) key := path.Join(SegmentPrefix, strconv.FormatInt(segID, 10))
value, err := ibNode.kvClient.Load(key) value, _ := ibNode.kvClient.Load(key)
if err != nil { err := proto.UnmarshalText(value, segMeta)
return nil, nil, err
}
err = proto.UnmarshalText(value, segMeta)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
collMeta := &etcdpb.CollectionMeta{} collMeta := &etcdpb.CollectionMeta{}
key = path.Join(CollectionPrefix, strconv.FormatInt(segMeta.GetCollectionID(), 10)) key = path.Join(CollectionPrefix, strconv.FormatInt(segMeta.GetCollectionID(), 10))
value, err = ibNode.kvClient.Load(key) value, _ = ibNode.kvClient.Load(key)
if err != nil {
return nil, nil, err
}
err = proto.UnmarshalText(value, collMeta) err = proto.UnmarshalText(value, collMeta)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err

View File

@ -13,13 +13,16 @@ function bred(){
files=() files=()
files_need_gofmt=() files_need_gofmt=()
if [ -f "$1" ];then if [[ $# -ne 0 ]]; then
files+=("$1") for arg in "$@"; do
fi if [ -f "$arg" ];then
files+=("$arg")
if [ -d "$1" ];then fi
for file in `find $1 -type f | grep "\.go$"`; do if [ -d "$arg" ];then
files+=("$file") for file in `find $arg -type f | grep "\.go$"`; do
files+=("$file")
done
fi
done done
fi fi