Update go 1.19 (#152)
* update to go 1.19
diff --git a/.github/workflows/e2e.storage.yml b/.github/workflows/e2e.storage.yml
index 02eb3f8..9840e35 100644
--- a/.github/workflows/e2e.storage.yml
+++ b/.github/workflows/e2e.storage.yml
@@ -55,7 +55,7 @@
- name: Install Go
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index ac275ce..8c89b58 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -33,7 +33,7 @@
- name: Install Go
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check License Header
@@ -66,7 +66,7 @@
- name: Install Go
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v3
@@ -100,7 +100,7 @@
- name: Install Go
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v3
diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml
index 051b9a2..1e6e78a 100644
--- a/.github/workflows/publish-docker.yml
+++ b/.github/workflows/publish-docker.yml
@@ -44,7 +44,7 @@
- name: Install Go
uses: actions/setup-go@v2
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Update dependencies
diff --git a/api/proto/banyandb/measure/v1/topn.pb.go b/api/proto/banyandb/measure/v1/topn.pb.go
index 92eb78e..2f3cc61 100644
--- a/api/proto/banyandb/measure/v1/topn.pb.go
+++ b/api/proto/banyandb/measure/v1/topn.pb.go
@@ -41,7 +41,7 @@
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-//TopNList contains a series of topN items
+// TopNList contains a series of topN items
type TopNList struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
diff --git a/api/proto/banyandb/measure/v1/write.pb.go b/api/proto/banyandb/measure/v1/write.pb.go
index e693cbb..ac30c4c 100644
--- a/api/proto/banyandb/measure/v1/write.pb.go
+++ b/api/proto/banyandb/measure/v1/write.pb.go
@@ -41,7 +41,7 @@
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-//DataPointValue is the data point for writing. It only contains values.
+// DataPointValue is the data point for writing. It only contains values.
type DataPointValue struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
diff --git a/api/proto/banyandb/model/v1/common.pb.go b/api/proto/banyandb/model/v1/common.pb.go
index b88a476..cd5e94a 100644
--- a/api/proto/banyandb/model/v1/common.pb.go
+++ b/api/proto/banyandb/model/v1/common.pb.go
@@ -337,6 +337,7 @@
unknownFields protoimpl.UnknownFields
// Types that are assignable to Value:
+ //
// *TagValue_Null
// *TagValue_Str
// *TagValue_StrArray
@@ -534,6 +535,7 @@
unknownFields protoimpl.UnknownFields
// Types that are assignable to Value:
+ //
// *FieldValue_Null
// *FieldValue_Str
// *FieldValue_Int
diff --git a/banyand/Dockerfile b/banyand/Dockerfile
index e6da33b..dc40e27 100644
--- a/banyand/Dockerfile
+++ b/banyand/Dockerfile
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM golang:1.18 AS dev
+FROM golang:1.19 AS dev
WORKDIR /app
ENV GOOS="linux"
ENV CGO_ENABLED=0
@@ -27,7 +27,7 @@
ENTRYPOINT ["air"]
-FROM golang:1.18 AS base
+FROM golang:1.19 AS base
ENV GOPATH "/go"
ENV GO111MODULE "on"
diff --git a/banyand/internal/cmd/root.go b/banyand/internal/cmd/root.go
index fb6d89f..0bbfbd5 100644
--- a/banyand/internal/cmd/root.go
+++ b/banyand/internal/cmd/root.go
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+// Package cmd is an internal package defining cli commands for BanyanDB
package cmd
import (
diff --git a/banyand/measure/encode.go b/banyand/measure/encode.go
index 936e018..7e29d0b 100644
--- a/banyand/measure/encode.go
+++ b/banyand/measure/encode.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package measure
import (
diff --git a/banyand/measure/field_flag_test.go b/banyand/measure/field_flag_test.go
index baec5b8..fba88db 100644
--- a/banyand/measure/field_flag_test.go
+++ b/banyand/measure/field_flag_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package measure
import (
diff --git a/banyand/measure/measure_write_test.go b/banyand/measure/measure_write_test.go
index ec2f3eb..935de8d 100644
--- a/banyand/measure/measure_write_test.go
+++ b/banyand/measure/measure_write_test.go
@@ -22,9 +22,9 @@
"encoding/json"
"time"
- "github.com/golang/protobuf/jsonpb"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
+ "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/timestamppb"
commonv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
@@ -132,10 +132,9 @@
rawDataPointValue, errMarshal := json.Marshal(template)
Expect(errMarshal).ShouldNot(HaveOccurred())
dataPointValue := &measurev1.DataPointValue{}
+ Expect(protojson.Unmarshal(rawDataPointValue, dataPointValue)).ShouldNot(HaveOccurred())
dataPointValue.Timestamp = timestamppb.New(baseTime.Add(time.Duration(i) * time.Minute))
- Expect(jsonpb.UnmarshalString(string(rawDataPointValue), dataPointValue)).ShouldNot(HaveOccurred())
- errInner := measure.Write(dataPointValue)
- Expect(errInner).ShouldNot(HaveOccurred())
+ Expect(measure.Write(dataPointValue)).Should(Succeed())
}
return baseTime
}
diff --git a/banyand/measure/metadata.go b/banyand/measure/metadata.go
index 9a455be..2fad3d5 100644
--- a/banyand/measure/metadata.go
+++ b/banyand/measure/metadata.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package measure
import (
diff --git a/banyand/observability/metric.go b/banyand/observability/metric.go
index 29f353b..180bc84 100644
--- a/banyand/observability/metric.go
+++ b/banyand/observability/metric.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package observability
import (
diff --git a/banyand/observability/type.go b/banyand/observability/type.go
index 1b26330..ab8cb1b 100644
--- a/banyand/observability/type.go
+++ b/banyand/observability/type.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package observability
type Statistics struct {
diff --git a/banyand/query/processor_test.go b/banyand/query/processor_test.go
index b72908b..e8bc07e 100644
--- a/banyand/query/processor_test.go
+++ b/banyand/query/processor_test.go
@@ -26,9 +26,9 @@
"strconv"
"time"
- "github.com/golang/protobuf/jsonpb"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
+ "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/apache/skywalking-banyandb/api/data"
@@ -158,7 +158,7 @@
rawSearchTagFamily, errMarshal := json.Marshal(template)
Expect(errMarshal).ShouldNot(HaveOccurred())
searchTagFamily := &modelv1.TagFamilyForWrite{}
- Expect(jsonpb.UnmarshalString(string(rawSearchTagFamily), searchTagFamily)).Should(Succeed())
+ Expect(protojson.Unmarshal(rawSearchTagFamily, searchTagFamily)).Should(Succeed())
e := &streamv1.ElementValue{
ElementId: strconv.Itoa(i),
Timestamp: timestamppb.New(baseTime.Add(500 * time.Millisecond * time.Duration(i))),
diff --git a/banyand/query/query_suite_test.go b/banyand/query/query_suite_test.go
index 53315da..970d5ee 100644
--- a/banyand/query/query_suite_test.go
+++ b/banyand/query/query_suite_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package query_test
import (
diff --git a/banyand/stream/stream_query_test.go b/banyand/stream/stream_query_test.go
index b0092c1..9735e4f 100644
--- a/banyand/stream/stream_query_test.go
+++ b/banyand/stream/stream_query_test.go
@@ -28,10 +28,10 @@
"strconv"
"time"
- "github.com/golang/protobuf/jsonpb"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
+ "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/apache/skywalking-banyandb/api/common"
@@ -990,7 +990,7 @@
rawSearchTagFamily, errMarshal := json.Marshal(template)
Expect(errMarshal).ShouldNot(HaveOccurred())
searchTagFamily := &modelv1.TagFamilyForWrite{}
- Expect(jsonpb.UnmarshalString(string(rawSearchTagFamily), searchTagFamily)).ShouldNot(HaveOccurred())
+ Expect(protojson.Unmarshal(rawSearchTagFamily, searchTagFamily)).ShouldNot(HaveOccurred())
e := &streamv1.ElementValue{
ElementId: strconv.Itoa(i),
Timestamp: timestamppb.New(baseTime.Add(500 * time.Millisecond * time.Duration(i))),
diff --git a/banyand/tsdb/bucket/bucket_suite_test.go b/banyand/tsdb/bucket/bucket_suite_test.go
index 8c442e3..59ca1fe 100644
--- a/banyand/tsdb/bucket/bucket_suite_test.go
+++ b/banyand/tsdb/bucket/bucket_suite_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package bucket_test
import (
diff --git a/banyand/tsdb/bucket/queue.go b/banyand/tsdb/bucket/queue.go
index 85b73fa..af13d6b 100644
--- a/banyand/tsdb/bucket/queue.go
+++ b/banyand/tsdb/bucket/queue.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package bucket
import (
diff --git a/banyand/tsdb/bucket/queue_test.go b/banyand/tsdb/bucket/queue_test.go
index fbda289..fb90169 100644
--- a/banyand/tsdb/bucket/queue_test.go
+++ b/banyand/tsdb/bucket/queue_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package bucket_test
import (
diff --git a/banyand/tsdb/bucket/strategy_test.go b/banyand/tsdb/bucket/strategy_test.go
index 80d9f8c..510707c 100644
--- a/banyand/tsdb/bucket/strategy_test.go
+++ b/banyand/tsdb/bucket/strategy_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package bucket_test
import (
diff --git a/banyand/tsdb/metric.go b/banyand/tsdb/metric.go
index d3d6c06..a45f57d 100644
--- a/banyand/tsdb/metric.go
+++ b/banyand/tsdb/metric.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package tsdb
import (
diff --git a/banyand/tsdb/scope.go b/banyand/tsdb/scope.go
index e2d0ff2..8233d9a 100644
--- a/banyand/tsdb/scope.go
+++ b/banyand/tsdb/scope.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package tsdb
import (
diff --git a/banyand/tsdb/series_test.go b/banyand/tsdb/series_test.go
index 820d1fe..da2493f 100644
--- a/banyand/tsdb/series_test.go
+++ b/banyand/tsdb/series_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package tsdb_test
import (
diff --git a/banyand/tsdb/shard_test.go b/banyand/tsdb/shard_test.go
index d798442..7ef3839 100644
--- a/banyand/tsdb/shard_test.go
+++ b/banyand/tsdb/shard_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package tsdb_test
import (
diff --git a/banyand/tsdb/tsdb.go b/banyand/tsdb/tsdb.go
index 34e84d2..20d8e6e 100644
--- a/banyand/tsdb/tsdb.go
+++ b/banyand/tsdb/tsdb.go
@@ -21,8 +21,6 @@
"context"
"fmt"
"io"
- "io/fs"
- "io/ioutil"
"os"
"strconv"
"strings"
@@ -182,9 +180,9 @@
blockSize: blockSize,
}
db.logger.Info().Str("path", opts.Location).Msg("initialized")
- var entries []fs.FileInfo
+ var entries []os.DirEntry
var err error
- if entries, err = ioutil.ReadDir(opts.Location); err != nil {
+ if entries, err = os.ReadDir(opts.Location); err != nil {
return nil, errors.Wrap(err, "failed to read directory contents failed")
}
thisContext := context.WithValue(ctx, logger.ContextKey, db.logger)
@@ -262,7 +260,7 @@
type WalkFn func(suffix, absolutePath string) error
func WalkDir(root, prefix string, walkFn WalkFn) error {
- files, err := ioutil.ReadDir(root)
+ files, err := os.ReadDir(root)
if err != nil {
return errors.Wrapf(err, "failed to walk the database path: %s", root)
}
diff --git a/banyand/tsdb/tsdb_suite_test.go b/banyand/tsdb/tsdb_suite_test.go
index 432ae1d..97c11f2 100644
--- a/banyand/tsdb/tsdb_suite_test.go
+++ b/banyand/tsdb/tsdb_suite_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package tsdb_test
import (
diff --git a/bydbctl/Dockerfile b/bydbctl/Dockerfile
index c1eaf5c..886eda6 100644
--- a/bydbctl/Dockerfile
+++ b/bydbctl/Dockerfile
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM golang:1.18 AS base
+FROM golang:1.19 AS base
ENV GOPATH "/go"
ENV GO111MODULE "on"
diff --git a/bydbctl/cmd/bydbctl/main.go b/bydbctl/cmd/bydbctl/main.go
index f7af3ba..ebb144e 100644
--- a/bydbctl/cmd/bydbctl/main.go
+++ b/bydbctl/cmd/bydbctl/main.go
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+// Package main provides main entry for the command-line toolkit, i.e. bydbctl
package main
import (
diff --git a/bydbctl/internal/cmd/root.go b/bydbctl/internal/cmd/root.go
index a84f69b..5f546e2 100644
--- a/bydbctl/internal/cmd/root.go
+++ b/bydbctl/internal/cmd/root.go
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+// Package cmd is an internal package defining cli commands for bydbctl
package cmd
import (
diff --git a/go.mod b/go.mod
index abd90a1..3b5b9d7 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/apache/skywalking-banyandb
-go 1.18
+go 1.19
require (
github.com/RoaringBitmap/roaring v0.9.1
@@ -9,7 +9,7 @@
github.com/dgraph-io/badger/v3 v3.2011.1
github.com/dgraph-io/ristretto v0.1.0
github.com/golang/mock v1.6.0
- github.com/golang/protobuf v1.5.2
+ github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8
github.com/google/uuid v1.3.0
github.com/klauspost/compress v1.15.6
diff --git a/pkg/grpchelper/client.go b/pkg/grpchelper/client.go
index 6e96a1e..aace243 100644
--- a/pkg/grpchelper/client.go
+++ b/pkg/grpchelper/client.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package grpchelper
import (
diff --git a/pkg/query/aggregation/aggregation.go b/pkg/query/aggregation/aggregation.go
index 8f7b2a1..708db22 100644
--- a/pkg/query/aggregation/aggregation.go
+++ b/pkg/query/aggregation/aggregation.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package aggregation
import (
diff --git a/pkg/query/aggregation/function.go b/pkg/query/aggregation/function.go
index 0361317..5144a81 100644
--- a/pkg/query/aggregation/function.go
+++ b/pkg/query/aggregation/function.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package aggregation
import "math"
diff --git a/pkg/query/logical/common_test.go b/pkg/query/logical/common_test.go
index cc616ea..0bc72fb 100644
--- a/pkg/query/logical/common_test.go
+++ b/pkg/query/logical/common_test.go
@@ -27,9 +27,9 @@
"testing"
"time"
- "github.com/golang/protobuf/jsonpb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/timestamppb"
commonv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
@@ -63,7 +63,7 @@
rawSearchTagFamily, errMarshal := json.Marshal(template)
t.NoError(errMarshal)
searchTagFamily := &modelv1.TagFamilyForWrite{}
- t.NoError(jsonpb.UnmarshalString(string(rawSearchTagFamily), searchTagFamily))
+ t.NoError(protojson.Unmarshal(rawSearchTagFamily, searchTagFamily))
e := &streamv1.ElementValue{
ElementId: strconv.Itoa(i),
Timestamp: timestamppb.New(baseTime.Add(500 * time.Millisecond * time.Duration(i))),
@@ -213,10 +213,10 @@
rawDataPointValue, errMarshal := json.Marshal(template)
t.NoError(errMarshal)
dataPointValue := &measurev1.DataPointValue{}
+ t.NoError(protojson.Unmarshal(rawDataPointValue, dataPointValue))
if dataPointValue.Timestamp == nil {
dataPointValue.Timestamp = timestamppb.New(baseTime.Add(time.Duration(i) * time.Minute))
}
- t.NoError(jsonpb.UnmarshalString(string(rawDataPointValue), dataPointValue))
errInner := measure.Write(dataPointValue)
t.NoError(errInner)
}
diff --git a/pkg/query/logical/iter.go b/pkg/query/logical/iter.go
index 5aa0bb7..739d237 100644
--- a/pkg/query/logical/iter.go
+++ b/pkg/query/logical/iter.go
@@ -94,9 +94,12 @@
// pushIterator pushes the given iterator into the underlying deque.
// Status will be immediately checked if the Iterator has a next value.
// 1 - If not, it will be close at once and will not be added to the slice,
-// which means inactive iterator does not exist in the deq.
+//
+// which means inactive iterator does not exist in the deq.
+//
// 2 - If so, it will be wrapped into a container and push to the deq.
-// Then we call SliceStable sort to sort the deq.
+//
+// Then we call SliceStable sort to sort the deq.
func (it *itemIter) pushIterator(iter tsdb.Iterator) {
if !iter.Next() {
_ = iter.Close()
diff --git a/pkg/query/logical/measure_plan_aggregation.go b/pkg/query/logical/measure_plan_aggregation.go
index 6f2bb0d..e665156 100644
--- a/pkg/query/logical/measure_plan_aggregation.go
+++ b/pkg/query/logical/measure_plan_aggregation.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package logical
import (
diff --git a/pkg/query/logical/measure_plan_groupby.go b/pkg/query/logical/measure_plan_groupby.go
index 9405771..79127f7 100644
--- a/pkg/query/logical/measure_plan_groupby.go
+++ b/pkg/query/logical/measure_plan_groupby.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package logical
import (
diff --git a/pkg/query/logical/measure_plan_top.go b/pkg/query/logical/measure_plan_top.go
index cf55dc6..7e53c31 100644
--- a/pkg/query/logical/measure_plan_top.go
+++ b/pkg/query/logical/measure_plan_top.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package logical
import (
diff --git a/pkg/query/logical/measure_top.go b/pkg/query/logical/measure_top.go
index b9e0dd2..56ae65b 100644
--- a/pkg/query/logical/measure_top.go
+++ b/pkg/query/logical/measure_top.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package logical
import (
diff --git a/pkg/query/logical/measure_top_test.go b/pkg/query/logical/measure_top_test.go
index 1d80ec7..4cbf96e 100644
--- a/pkg/query/logical/measure_top_test.go
+++ b/pkg/query/logical/measure_top_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package logical_test
import (
diff --git a/pkg/query/logical/stream_analyzer.go b/pkg/query/logical/stream_analyzer.go
index e06ca32..d8f5883 100644
--- a/pkg/query/logical/stream_analyzer.go
+++ b/pkg/query/logical/stream_analyzer.go
@@ -140,8 +140,9 @@
// Basically,
// 1 - If no criteria is given, we can only scan all shards
// 2 - If criteria is given, but all of those fields exist in the "entity" definition,
-// i.e. they are top-level sharding keys. For example, for the current skywalking's streamSchema,
-// we use service_id + service_instance_id + state as the compound sharding keys.
+//
+// i.e. they are top-level sharding keys. For example, for the current skywalking's streamSchema,
+// we use service_id + service_instance_id + state as the compound sharding keys.
func parseStreamFields(criteria *streamv1.QueryRequest, metadata *commonv1.Metadata, s Schema) (UnresolvedPlan, error) {
timeRange := criteria.GetTimeRange()
diff --git a/pkg/run/run.go b/pkg/run/run.go
index 791e33e..1826d2b 100644
--- a/pkg/run/run.go
+++ b/pkg/run/run.go
@@ -282,24 +282,23 @@
//
// The following phases are executed in the following sequence:
//
-// Config phase (serially, in order of Unit registration)
-// - FlagSet() Get & register all FlagSets from Config Units.
-// - Flag Parsing Using the provided args (os.Args if empty)
-// - Validate() Validate Config Units. Exit on first error.
+// Config phase (serially, in order of Unit registration)
+// - FlagSet() Get & register all FlagSets from Config Units.
+// - Flag Parsing Using the provided args (os.Args if empty)
+// - Validate() Validate Config Units. Exit on first error.
//
-// PreRunner phase (serially, in order of Unit registration)
-// - PreRun() Execute PreRunner Units. Exit on first error.
+// PreRunner phase (serially, in order of Unit registration)
+// - PreRun() Execute PreRunner Units. Exit on first error.
//
-// Service phase (concurrently)
-// - Serve() Execute all Service Units in separate Go routines.
-// - Wait Block until one of the Serve() methods returns
-// - GracefulStop() Call interrupt handlers of all Service Units.
+// Service phase (concurrently)
+// - Serve() Execute all Service Units in separate Go routines.
+// - Wait Block until one of the Serve() methods returns
+// - GracefulStop() Call interrupt handlers of all Service Units.
//
-// Run will return with the originating error on:
-// - first Config.Validate() returning an error
-// - first PreRunner.PreRun() returning an error
-// - first Service.Serve() returning (error or nil)
-//
+// Run will return with the originating error on:
+// - first Config.Validate() returning an error
+// - first PreRunner.PreRun() returning an error
+// - first Service.Serve() returning (error or nil)
func (g *Group) Run() (err error) {
// run config registration and flag parsing stages
if interrupted, errRun := g.RunConfig(); interrupted || errRun != nil {
diff --git a/pkg/test/helpers/fail_interceptor.go b/pkg/test/helpers/fail_interceptor.go
index ac591c2..a442d27 100644
--- a/pkg/test/helpers/fail_interceptor.go
+++ b/pkg/test/helpers/fail_interceptor.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package helpers
import (
diff --git a/pkg/test/helpers/grpc_health.go b/pkg/test/helpers/grpc_health.go
index 41775e7..5b551d0 100644
--- a/pkg/test/helpers/grpc_health.go
+++ b/pkg/test/helpers/grpc_health.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package helpers
import (
diff --git a/pkg/test/matcher.go b/pkg/test/matcher.go
index f218bf0..2a0a0dc 100644
--- a/pkg/test/matcher.go
+++ b/pkg/test/matcher.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package test
import (
diff --git a/pkg/test/measure/traffic/traffic.go b/pkg/test/measure/traffic/traffic.go
index b942590..b7f746b 100644
--- a/pkg/test/measure/traffic/traffic.go
+++ b/pkg/test/measure/traffic/traffic.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+
package traffic
import (
diff --git a/pkg/test/space.go b/pkg/test/space.go
index 8fafdb3..9e9e64a 100644
--- a/pkg/test/space.go
+++ b/pkg/test/space.go
@@ -19,7 +19,6 @@
import (
"fmt"
- "io/ioutil"
"os"
"github.com/stretchr/testify/require"
@@ -27,7 +26,7 @@
func Space(t *require.Assertions) (tempDir string, deferFunc func()) {
var tempDirErr error
- tempDir, tempDirErr = ioutil.TempDir("", "banyandb-test-*")
+ tempDir, tempDirErr = os.MkdirTemp("", "banyandb-test-*")
t.Nil(tempDirErr)
return tempDir, func() {
if err := os.RemoveAll(tempDir); err != nil {
@@ -37,7 +36,7 @@
}
func NewSpace() (tempDir string, deferFunc func(), err error) {
- tempDir, err = ioutil.TempDir("", "banyandb-test-*")
+ tempDir, err = os.MkdirTemp("", "banyandb-test-*")
return tempDir, func() {
if err = os.RemoveAll(tempDir); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Error while removing dir: %v\n", err)
diff --git a/pkg/test/stream/traffic/traffic.go b/pkg/test/stream/traffic/traffic.go
index 334c93d..93ac164 100644
--- a/pkg/test/stream/traffic/traffic.go
+++ b/pkg/test/stream/traffic/traffic.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+
package traffic
import (
@@ -31,7 +31,7 @@
"time"
"github.com/dgraph-io/ristretto/z"
- "github.com/golang/protobuf/jsonpb"
+ "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -45,7 +45,7 @@
var (
//go:embed searchable_template.json
- content string
+ content []byte
l = logger.GetLogger("test_stream_traffic")
)
@@ -57,7 +57,7 @@
func SendWrites(ts TestCase) (*z.Closer, error) {
searchTagFamily := &modelv1.TagFamilyForWrite{}
- err := jsonpb.UnmarshalString(content, searchTagFamily)
+ err := protojson.Unmarshal(content, searchTagFamily)
if err != nil {
l.Err(err).Msg("unmarshal template")
return nil, err
diff --git a/pkg/timestamp/clock.go b/pkg/timestamp/clock.go
index 3d55559..92b845a 100644
--- a/pkg/timestamp/clock.go
+++ b/pkg/timestamp/clock.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp
import (
diff --git a/pkg/timestamp/duration.go b/pkg/timestamp/duration.go
index fd7fdbb..8b07aa2 100644
--- a/pkg/timestamp/duration.go
+++ b/pkg/timestamp/duration.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp
import (
diff --git a/pkg/timestamp/duration_test.go b/pkg/timestamp/duration_test.go
index 1ce1d1b..6ed1eef 100644
--- a/pkg/timestamp/duration_test.go
+++ b/pkg/timestamp/duration_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp
import (
diff --git a/pkg/timestamp/nano.go b/pkg/timestamp/nano.go
index 085d471..c83decb 100644
--- a/pkg/timestamp/nano.go
+++ b/pkg/timestamp/nano.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp
import (
@@ -36,6 +35,7 @@
)
// FastRandN is a fast thread local random function.
+//
//go:linkname fastRandN runtime.fastrandn
func fastRandN(n uint32) uint32
diff --git a/pkg/timestamp/nano_test.go b/pkg/timestamp/nano_test.go
index 6b601ba..422f99f 100644
--- a/pkg/timestamp/nano_test.go
+++ b/pkg/timestamp/nano_test.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp_test
import (
diff --git a/pkg/timestamp/range.go b/pkg/timestamp/range.go
index e0db185..44f0bc0 100644
--- a/pkg/timestamp/range.go
+++ b/pkg/timestamp/range.go
@@ -6,7 +6,7 @@
// 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
+// 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
@@ -14,7 +14,6 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
package timestamp
import (
diff --git a/scripts/build/lint-bin.mk b/scripts/build/lint-bin.mk
index f29b241..b33b5a5 100644
--- a/scripts/build/lint-bin.mk
+++ b/scripts/build/lint-bin.mk
@@ -1,4 +1,4 @@
LINTER := $(tool_bin)/golangci-lint
$(LINTER):
- @GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
+ @GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0
diff --git a/scripts/ci/check/version_test.go b/scripts/ci/check/version_test.go
index 367d605..11df493 100644
--- a/scripts/ci/check/version_test.go
+++ b/scripts/ci/check/version_test.go
@@ -28,7 +28,7 @@
"golang.org/x/mod/modfile"
)
-const GoVersion = "1.18.3"
+const GoVersion = "1.19"
func TestGoVersion(t *testing.T) {
goversion, err := exec.Command("go", "version").Output()
@@ -36,17 +36,17 @@
currentVersion := strings.Split(string(goversion), " ")[2][2:]
- currentMayorMinor, currentPatch := splitVersion(currentVersion)
- expectedMayorMinor, expectedPatch := splitVersion(GoVersion)
+ currentMajorMinor, currentPatch := splitVersion(currentVersion)
+ expectedMajorMinor, expectedPatch := splitVersion(GoVersion)
- require.Equal(t, currentMayorMinor, expectedMayorMinor,
+ require.Equal(t, currentMajorMinor, expectedMajorMinor,
"go version <mayor>.<minor> mismatch: current[%s], want[%s]",
- currentMayorMinor, expectedMayorMinor)
+ currentMajorMinor, expectedMajorMinor)
require.True(t, currentPatch >= expectedPatch,
"go version unsupported, current[%s.%s], minimum[%s.%s]",
- currentMayorMinor, currentPatch,
- currentMayorMinor, expectedPatch,
+ currentMajorMinor, currentPatch,
+ currentMajorMinor, expectedPatch,
)
path, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
@@ -59,14 +59,18 @@
m := parseGoMod(t, root+"/go.mod")
- require.Equal(t, expectedMayorMinor, m.Go.Version,
+ require.Equal(t, expectedMajorMinor, m.Go.Version,
"go.mod version mismatch: current[%s], want[%s]",
- m.Go.Version, expectedMayorMinor)
+ m.Go.Version, expectedMajorMinor)
}
func splitVersion(v string) (string, string) {
- lastDotPos := strings.LastIndex(v, ".")
- return v[:lastDotPos], v[lastDotPos+1:]
+ versionParts := strings.SplitN(v, ".", 3)
+ // if v only has two parts, it can be <major>.<minor>
+ if len(versionParts) == 2 {
+ return v, "0"
+ }
+ return strings.Join(versionParts[0:2], "."), versionParts[2]
}
func parseGoMod(t *testing.T, gomod string) *modfile.File {
diff --git a/ui/embed.go b/ui/embed.go
index ca28177..7d3657c 100644
--- a/ui/embed.go
+++ b/ui/embed.go
@@ -15,10 +15,12 @@
// specific language governing permissions and limitations
// under the License.
+// Package ui provides Web based UI for BanyanDB
package ui
import "embed"
// DistContent contains ui distributed pages
+//
//go:embed dist
var DistContent embed.FS