Skip to content

Commit

Permalink
fix: fix reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
caiweiwei.cww committed Dec 25, 2021
1 parent 7a3c2f1 commit 3019af3
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 9 deletions.
1 change: 0 additions & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ header: # `header` section is configurations for source codes license header.
- 'pkg/resolver/mysql/encoding.go'
- 'pkg/resolver/mysql/sql_error.go'
- 'pkg/resolver/mysql/type.go'
- 'testdata'
comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`.

# license-location-threshold specifies the index threshold where the license header can be located,
Expand Down
5 changes: 2 additions & 3 deletions pkg/proto/rule/database_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ func (dt DatabaseTables) Or(other DatabaseTables) DatabaseTables {
if dt == nil || other == nil {
return nil
}
if dt.IsEmpty() {

if dt.IsEmpty() || other.IsEmpty() {
return other
}
if other.IsEmpty() {
return other
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/proto/rule/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ import (
"strconv"
"strings"
"time"
)

import (
"github.com/pkg/errors"
)

import (
"github.com/dubbogo/arana/pkg/util/rand2"
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/proto/rule/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ package rule
import (
"fmt"
"sync"
)

import (
"github.com/pkg/errors"
)

Expand Down
5 changes: 5 additions & 0 deletions pkg/proto/rule/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ package rule_test
import (
"fmt"
"testing"
)

import (
"github.com/golang/mock/gomock"

"github.com/stretchr/testify/assert"
)

import (
"github.com/dubbogo/arana/pkg/proto/rule"
"github.com/dubbogo/arana/testdata"
)
Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/cmp/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
"strconv"
"strings"
"time"
)

import (
"github.com/pkg/errors"
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/logical/logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import (
"fmt"
"sort"
"strings"
)

import (
"github.com/dubbogo/arana/pkg/runtime/misc"
)

Expand Down
4 changes: 4 additions & 0 deletions pkg/runtime/logical/logical_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ package logical_test

import (
"testing"
)

import (
"github.com/stretchr/testify/assert"
)

import (
. "github.com/dubbogo/arana/pkg/runtime/logical"
)

Expand Down
6 changes: 1 addition & 5 deletions pkg/runtime/misc/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ func FirstNonZeroInt64(first, second int64, others ...int64) int64 {
}

func PadRight(str, pad string, length int) string {
if len(str) == length {
return str
}

if len(str) > length {
if len(str) >= length {
return str[:length]
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/runtime/rule/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ import (
"fmt"
"strconv"
"testing"
)

import (
"github.com/stretchr/testify/assert"
)

import (
"github.com/dubbogo/arana/pkg/proto/rule"
"github.com/dubbogo/arana/pkg/runtime/cmp"
. "github.com/dubbogo/arana/pkg/runtime/rule"
Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/rule/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package rule

import (
"github.com/pkg/errors"
)

import (
"github.com/dubbogo/arana/pkg/proto/rule"
"github.com/dubbogo/arana/pkg/runtime/cmp"
)
Expand Down
4 changes: 4 additions & 0 deletions pkg/runtime/rule/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ package rule_test
import (
"sort"
"testing"
)

import (
"github.com/stretchr/testify/assert"
)

import (
"github.com/dubbogo/arana/pkg/runtime/cmp"
. "github.com/dubbogo/arana/pkg/runtime/rule"
)
Expand Down
18 changes: 18 additions & 0 deletions testdata/testdata.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//

// Package testdata 测试资源包
package testdata

Expand Down

0 comments on commit 3019af3

Please sign in to comment.