From 6e4cf7ffef0c4c457d21b4d990f58e95fb6ed2c7 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Fri, 3 Apr 2020 17:40:36 -0500 Subject: [PATCH] refactor: fix imports from go template files (#17615) --- pkg/data/gen/arrays.gen.go.tmpl | 6 +++--- pkg/data/gen/precision_string.go | 12 ++++++++++++ pkg/data/gen/values_sequence.gen.go.tmpl | 6 +++--- storage/flux/table.gen.go.tmpl | 6 +++--- storage/reads/array_cursor.gen.go.tmpl | 2 +- storage/reads/datatypes/storage_common.pb.go | 2 +- tsdb/tsm1/array_cursor.gen.go.tmpl | 2 +- tsdb/tsm1/array_cursor_iterator.gen.go.tmpl | 6 +++--- tsdb/tsm1/compact.gen.go.tmpl | 2 +- tsdb/tsm1/encoding.gen.go.tmpl | 2 +- tsdb/tsm1/engine.go | 6 +++--- tsdb/tsm1/file_store.gen.go.tmpl | 2 +- tsdb/tsm1/reader.gen.go.tmpl | 2 +- 13 files changed, 34 insertions(+), 22 deletions(-) diff --git a/pkg/data/gen/arrays.gen.go.tmpl b/pkg/data/gen/arrays.gen.go.tmpl index 7e011ff350b..776b1a8ec09 100644 --- a/pkg/data/gen/arrays.gen.go.tmpl +++ b/pkg/data/gen/arrays.gen.go.tmpl @@ -1,8 +1,8 @@ package gen import ( - "github.com/influxdata/influxdb/tsdb/cursors" - "github.com/influxdata/influxdb/tsdb/tsm1" + "github.com/influxdata/influxdb/v2/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/tsm1" ) {{range .}} @@ -33,4 +33,4 @@ func (a *{{$typename}}) Copy(dst *cursors.{{$tsdbname}}) { dst.Timestamps = append(dst.Timestamps[:0], a.Timestamps...) dst.Values = append(dst.Values[:0], a.Values...) } -{{end}} \ No newline at end of file +{{end}} diff --git a/pkg/data/gen/precision_string.go b/pkg/data/gen/precision_string.go index 8c78f3fc979..e53b4712bad 100644 --- a/pkg/data/gen/precision_string.go +++ b/pkg/data/gen/precision_string.go @@ -4,6 +4,18 @@ package gen import "strconv" +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[precisionMillisecond-0] + _ = x[precisionNanosecond-1] + _ = x[precisionMicrosecond-2] + _ = x[precisionSecond-3] + _ = x[precisionMinute-4] + _ = x[precisionHour-5] +} + const _precision_name = "MillisecondNanosecondMicrosecondSecondMinuteHour" var _precision_index = [...]uint8{0, 11, 21, 32, 38, 44, 48} diff --git a/pkg/data/gen/values_sequence.gen.go.tmpl b/pkg/data/gen/values_sequence.gen.go.tmpl index be57d8a2c91..562704cf5bc 100644 --- a/pkg/data/gen/values_sequence.gen.go.tmpl +++ b/pkg/data/gen/values_sequence.gen.go.tmpl @@ -1,8 +1,8 @@ package gen import ( - "github.com/influxdata/influxdb/models" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/models" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{range .}} @@ -57,4 +57,4 @@ func (s *time{{.Name}}ValuesSequence) Values() Values { func (s *time{{.Name}}ValuesSequence) ValueType() models.FieldType { return models.{{.Name}} } -{{end}} \ No newline at end of file +{{end}} diff --git a/storage/flux/table.gen.go.tmpl b/storage/flux/table.gen.go.tmpl index 863fce03690..d55592df497 100644 --- a/storage/flux/table.gen.go.tmpl +++ b/storage/flux/table.gen.go.tmpl @@ -7,9 +7,9 @@ import ( "github.com/influxdata/flux/arrow" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/memory" - "github.com/influxdata/influxdb/models" - storage "github.com/influxdata/influxdb/storage/reads" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/models" + storage "github.com/influxdata/influxdb/v2/storage/reads" + "github.com/influxdata/influxdb/v2/tsdb/cursors" "github.com/pkg/errors" ) {{range .}} diff --git a/storage/reads/array_cursor.gen.go.tmpl b/storage/reads/array_cursor.gen.go.tmpl index dbb6ca5e7a4..931b86380f2 100644 --- a/storage/reads/array_cursor.gen.go.tmpl +++ b/storage/reads/array_cursor.gen.go.tmpl @@ -3,7 +3,7 @@ package reads import ( "errors" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) const ( diff --git a/storage/reads/datatypes/storage_common.pb.go b/storage/reads/datatypes/storage_common.pb.go index 5f16e9bcc73..f963f5bcc7f 100644 --- a/storage/reads/datatypes/storage_common.pb.go +++ b/storage/reads/datatypes/storage_common.pb.go @@ -2222,7 +2222,7 @@ func (m *CapabilitiesResponse) MarshalTo(dAtA []byte) (int, error) { var l int _ = l if len(m.Caps) > 0 { - for k := range m.Caps { + for k, _ := range m.Caps { dAtA[i] = 0xa i++ v := m.Caps[k] diff --git a/tsdb/tsm1/array_cursor.gen.go.tmpl b/tsdb/tsm1/array_cursor.gen.go.tmpl index 5c7cd9a5a8b..ea1f1d0ac5d 100644 --- a/tsdb/tsm1/array_cursor.gen.go.tmpl +++ b/tsdb/tsm1/array_cursor.gen.go.tmpl @@ -3,7 +3,7 @@ package tsm1 import ( "sort" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) // Array Cursors diff --git a/tsdb/tsm1/array_cursor_iterator.gen.go.tmpl b/tsdb/tsm1/array_cursor_iterator.gen.go.tmpl index 1b682692327..4140033ca77 100644 --- a/tsdb/tsm1/array_cursor_iterator.gen.go.tmpl +++ b/tsdb/tsm1/array_cursor_iterator.gen.go.tmpl @@ -3,9 +3,9 @@ package tsm1 import ( "context" - "github.com/influxdata/influxdb/models" - "github.com/influxdata/influxdb/query" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/models" + "github.com/influxdata/influxdb/v2/query" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{range .}} diff --git a/tsdb/tsm1/compact.gen.go.tmpl b/tsdb/tsm1/compact.gen.go.tmpl index 00bc6c393d7..f35fa2b0fba 100644 --- a/tsdb/tsm1/compact.gen.go.tmpl +++ b/tsdb/tsm1/compact.gen.go.tmpl @@ -3,7 +3,7 @@ package tsm1 import ( "sort" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{range .}} diff --git a/tsdb/tsm1/encoding.gen.go.tmpl b/tsdb/tsm1/encoding.gen.go.tmpl index 3bdc6d9f578..f4fc3c1831d 100644 --- a/tsdb/tsm1/encoding.gen.go.tmpl +++ b/tsdb/tsm1/encoding.gen.go.tmpl @@ -3,7 +3,7 @@ package tsm1 import ( "sort" - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{range .}} diff --git a/tsdb/tsm1/engine.go b/tsdb/tsm1/engine.go index a4ca605c9f7..0a5655979e6 100644 --- a/tsdb/tsm1/engine.go +++ b/tsdb/tsm1/engine.go @@ -1,5 +1,5 @@ // Package tsm1 provides a TSDB in the Time Structured Merge tree format. -package tsm1 // import "github.com/influxdata/influxdb/tsdb/tsm1" +package tsm1 import ( "bytes" @@ -32,8 +32,8 @@ import ( ) //go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@array_cursor.gen.go.tmpldata array_cursor.gen.go.tmpl array_cursor_iterator.gen.go.tmpl -//go:generate env GO111MODULE=on go run github.com/influxdata/influxdb/tools/tmpl -i -data=file_store.gen.go.tmpldata file_store.gen.go.tmpl=file_store.gen.go -//go:generate env GO111MODULE=on go run github.com/influxdata/influxdb/tools/tmpl -i -d isArray=y -data=file_store.gen.go.tmpldata file_store.gen.go.tmpl=file_store_array.gen.go +//go:generate env GO111MODULE=on go run github.com/influxdata/influxdb/v2/tools/tmpl -i -data=file_store.gen.go.tmpldata file_store.gen.go.tmpl=file_store.gen.go +//go:generate env GO111MODULE=on go run github.com/influxdata/influxdb/v2/tools/tmpl -i -d isArray=y -data=file_store.gen.go.tmpldata file_store.gen.go.tmpl=file_store_array.gen.go //go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@encoding.gen.go.tmpldata encoding.gen.go.tmpl //go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@compact.gen.go.tmpldata compact.gen.go.tmpl //go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@reader.gen.go.tmpldata reader.gen.go.tmpl diff --git a/tsdb/tsm1/file_store.gen.go.tmpl b/tsdb/tsm1/file_store.gen.go.tmpl index 88d8c4126c7..e96186d61d2 100644 --- a/tsdb/tsm1/file_store.gen.go.tmpl +++ b/tsdb/tsm1/file_store.gen.go.tmpl @@ -1,7 +1,7 @@ package tsm1 import ( - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{$isArray := .D.isArray}} {{$isNotArray := not $isArray}} diff --git a/tsdb/tsm1/reader.gen.go.tmpl b/tsdb/tsm1/reader.gen.go.tmpl index a7b25f3d6d7..68f550caafe 100644 --- a/tsdb/tsm1/reader.gen.go.tmpl +++ b/tsdb/tsm1/reader.gen.go.tmpl @@ -1,7 +1,7 @@ package tsm1 import ( - "github.com/influxdata/influxdb/tsdb/cursors" + "github.com/influxdata/influxdb/v2/tsdb/cursors" ) {{range .}}