From a47be1f87523c470897c1cb2e4152892c5f9a26b Mon Sep 17 00:00:00 2001 From: zer0 Date: Thu, 1 Dec 2022 15:08:24 +0800 Subject: [PATCH 1/2] feat: upgrade module to v3 then can import v3 tag --- Makefile | 6 +++--- cmd/importer.go | 12 ++++++------ go.mod | 2 +- pkg/client/clientmgr.go | 6 +++--- pkg/client/clientpool.go | 6 +++--- pkg/cmd/runner.go | 16 ++++++++-------- pkg/config/config.go | 6 +++--- pkg/config/config_test.go | 4 ++-- pkg/csv/errwriter.go | 6 +++--- pkg/csv/reader.go | 6 +++--- pkg/errhandler/datawriter.go | 2 +- pkg/errhandler/handler.go | 8 ++++---- pkg/logger/logger.go | 2 +- pkg/reader/batch.go | 2 +- pkg/reader/batchmgr.go | 6 +++--- pkg/reader/reader.go | 10 +++++----- pkg/stats/statsmgr.go | 8 ++++---- pkg/web/httpserver.go | 8 ++++---- pkg/web/taskmgr.go | 4 ++-- 19 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Makefile b/Makefile index f54eca25..7b69bd15 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ default: build build: clean fmt @cd cmd; \ CGO_ENABLED=0 go build -ldflags "\ - -X 'github.com/vesoft-inc/nebula-importer/pkg/version.GoVersion=$(shell go version)' \ - -X 'github.com/vesoft-inc/nebula-importer/pkg/version.GitHash=$(shell git rev-parse HEAD)'\ - -X 'github.com/vesoft-inc/nebula-importer/pkg/version.Tag=$(shell git describe --exact-match --abbrev=0 --tags | sed 's/^v//')'\ + -X 'github.com/vesoft-inc/nebula-importer/v3/pkg/version.GoVersion=$(shell go version)' \ + -X 'github.com/vesoft-inc/nebula-importer/v3/pkg/version.GitHash=$(shell git rev-parse HEAD)'\ + -X 'github.com/vesoft-inc/nebula-importer/v3/pkg/version.Tag=$(shell git describe --exact-match --abbrev=0 --tags | sed 's/^v//')'\ " -o nebula-importer; \ mv nebula-importer ..; @echo "nebula-importer has been outputed to $$(pwd)/nebula-importer"; diff --git a/cmd/importer.go b/cmd/importer.go index e2fa8c62..83a336f7 100644 --- a/cmd/importer.go +++ b/cmd/importer.go @@ -7,12 +7,12 @@ import ( "os" "time" - "github.com/vesoft-inc/nebula-importer/pkg/cmd" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/errors" - "github.com/vesoft-inc/nebula-importer/pkg/logger" - "github.com/vesoft-inc/nebula-importer/pkg/version" - "github.com/vesoft-inc/nebula-importer/pkg/web" + "github.com/vesoft-inc/nebula-importer/v3/pkg/cmd" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/errors" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/version" + "github.com/vesoft-inc/nebula-importer/v3/pkg/web" ) var configuration = flag.String("config", "", "Specify importer configure file path") diff --git a/go.mod b/go.mod index 7ca22567..79d8260e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/vesoft-inc/nebula-importer +module github.com/vesoft-inc/nebula-importer/v3 require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/pkg/client/clientmgr.go b/pkg/client/clientmgr.go index a28b94f4..2e6f15a5 100644 --- a/pkg/client/clientmgr.go +++ b/pkg/client/clientmgr.go @@ -1,9 +1,9 @@ package client import ( - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type NebulaClientMgr struct { diff --git a/pkg/client/clientpool.go b/pkg/client/clientpool.go index 3290d86c..aa77dcda 100644 --- a/pkg/client/clientpool.go +++ b/pkg/client/clientpool.go @@ -7,9 +7,9 @@ import ( "time" nebula "github.com/vesoft-inc/nebula-go/v3" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type ClientPool struct { diff --git a/pkg/cmd/runner.go b/pkg/cmd/runner.go index ae54b5d8..7497b855 100644 --- a/pkg/cmd/runner.go +++ b/pkg/cmd/runner.go @@ -5,14 +5,14 @@ import ( "fmt" "sync" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/client" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/errhandler" - importerError "github.com/vesoft-inc/nebula-importer/pkg/errors" - "github.com/vesoft-inc/nebula-importer/pkg/logger" - "github.com/vesoft-inc/nebula-importer/pkg/reader" - "github.com/vesoft-inc/nebula-importer/pkg/stats" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/client" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/errhandler" + importerError "github.com/vesoft-inc/nebula-importer/v3/pkg/errors" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/reader" + "github.com/vesoft-inc/nebula-importer/v3/pkg/stats" ) type Runner struct { diff --git a/pkg/config/config.go b/pkg/config/config.go index 90c7eb1d..122e278f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -11,9 +11,9 @@ import ( "strings" "time" - "github.com/vesoft-inc/nebula-importer/pkg/base" - ierrors "github.com/vesoft-inc/nebula-importer/pkg/errors" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + ierrors "github.com/vesoft-inc/nebula-importer/v3/pkg/errors" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" "gopkg.in/yaml.v2" ) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 4a8fcd59..2b269719 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -10,10 +10,10 @@ import ( "text/template" "github.com/stretchr/testify/assert" - "github.com/vesoft-inc/nebula-importer/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" "gopkg.in/yaml.v2" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) func TestYAMLParser(t *testing.T) { diff --git a/pkg/csv/errwriter.go b/pkg/csv/errwriter.go index 4a52831d..a861c491 100644 --- a/pkg/csv/errwriter.go +++ b/pkg/csv/errwriter.go @@ -5,9 +5,9 @@ import ( "os" "strings" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type ErrWriter struct { diff --git a/pkg/csv/reader.go b/pkg/csv/reader.go index 79b545c0..e9f2cadf 100644 --- a/pkg/csv/reader.go +++ b/pkg/csv/reader.go @@ -8,9 +8,9 @@ import ( "io" "os" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type CSVReader struct { diff --git a/pkg/errhandler/datawriter.go b/pkg/errhandler/datawriter.go index e4c3bb1d..1a6201a6 100644 --- a/pkg/errhandler/datawriter.go +++ b/pkg/errhandler/datawriter.go @@ -3,7 +3,7 @@ package errhandler import ( "os" - "github.com/vesoft-inc/nebula-importer/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" ) type DataWriter interface { diff --git a/pkg/errhandler/handler.go b/pkg/errhandler/handler.go index b5dfb65c..5ad22acd 100644 --- a/pkg/errhandler/handler.go +++ b/pkg/errhandler/handler.go @@ -5,10 +5,10 @@ import ( "os" "strings" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/csv" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/csv" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type Handler struct { diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index b25de059..870fddcd 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -8,7 +8,7 @@ import ( "path/filepath" "runtime" - "github.com/vesoft-inc/nebula-importer/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" ) type Logger interface { diff --git a/pkg/reader/batch.go b/pkg/reader/batch.go index 0cf07abc..47390a7c 100644 --- a/pkg/reader/batch.go +++ b/pkg/reader/batch.go @@ -3,7 +3,7 @@ package reader import ( "fmt" - "github.com/vesoft-inc/nebula-importer/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" ) type Batch struct { diff --git a/pkg/reader/batchmgr.go b/pkg/reader/batchmgr.go index f8247afa..f1e04844 100644 --- a/pkg/reader/batchmgr.go +++ b/pkg/reader/batchmgr.go @@ -6,9 +6,9 @@ import ( "hash/fnv" "strings" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type BatchMgr struct { diff --git a/pkg/reader/reader.go b/pkg/reader/reader.go index aa1cbf6f..efbcb958 100644 --- a/pkg/reader/reader.go +++ b/pkg/reader/reader.go @@ -10,11 +10,11 @@ import ( "strings" "time" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/csv" - "github.com/vesoft-inc/nebula-importer/pkg/errors" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/csv" + "github.com/vesoft-inc/nebula-importer/v3/pkg/errors" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type DataFileReader interface { diff --git a/pkg/stats/statsmgr.go b/pkg/stats/statsmgr.go index 66423bae..eaa00045 100644 --- a/pkg/stats/statsmgr.go +++ b/pkg/stats/statsmgr.go @@ -4,10 +4,10 @@ import ( "fmt" "time" - "github.com/vesoft-inc/nebula-importer/pkg/base" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/logger" - "github.com/vesoft-inc/nebula-importer/pkg/reader" + "github.com/vesoft-inc/nebula-importer/v3/pkg/base" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/reader" ) type StatsMgr struct { diff --git a/pkg/web/httpserver.go b/pkg/web/httpserver.go index 8ab94699..a7e9d1dc 100644 --- a/pkg/web/httpserver.go +++ b/pkg/web/httpserver.go @@ -8,10 +8,10 @@ import ( "strings" "sync" - "github.com/vesoft-inc/nebula-importer/pkg/cmd" - "github.com/vesoft-inc/nebula-importer/pkg/config" - "github.com/vesoft-inc/nebula-importer/pkg/errors" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/cmd" + "github.com/vesoft-inc/nebula-importer/v3/pkg/config" + "github.com/vesoft-inc/nebula-importer/v3/pkg/errors" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type WebServer struct { diff --git a/pkg/web/taskmgr.go b/pkg/web/taskmgr.go index ff0bf44f..b1f98be2 100644 --- a/pkg/web/taskmgr.go +++ b/pkg/web/taskmgr.go @@ -3,8 +3,8 @@ package web import ( "sync" - "github.com/vesoft-inc/nebula-importer/pkg/cmd" - "github.com/vesoft-inc/nebula-importer/pkg/logger" + "github.com/vesoft-inc/nebula-importer/v3/pkg/cmd" + "github.com/vesoft-inc/nebula-importer/v3/pkg/logger" ) type taskMgr struct { From f3bad56582ba0d1da1db63eb3fcd14d38ef64a77 Mon Sep 17 00:00:00 2001 From: zer0 Date: Thu, 2 Feb 2023 21:19:04 +0800 Subject: [PATCH 2/2] Update config.go --- pkg/picker/config.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/picker/config.go b/pkg/picker/config.go index b832efcd..05262809 100644 --- a/pkg/picker/config.go +++ b/pkg/picker/config.go @@ -7,14 +7,13 @@ import ( // Config is the configuration to build Picker // The priority is as follows: -// -// ConcatItems > Indices -// Nullable -// DefaultValue -// NullValue, if set to null, subsequent conversions will be skipped. -// Type -// Function -// CheckOnPost +// ConcatItems > Indices +// Nullable +// DefaultValue +// NullValue, if set to null, subsequent conversions will be skipped. +// Type +// Function +// CheckOnPost type Config struct { ConcatItems ConcatItems // Concat index column, constant, or mixed. Indices []int // Set index columns, the first non-null.