diff --git a/.gitignore b/.gitignore index fe63f8b6f..6909ee443 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,6 @@ tree.txt # system ignore Thumbs.db + +# client-go +go.env \ No newline at end of file diff --git a/hugegraph-client-go/Makefile b/hugegraph-client-go/Makefile index e5181e69b..0c49457e6 100644 --- a/hugegraph-client-go/Makefile +++ b/hugegraph-client-go/Makefile @@ -22,7 +22,8 @@ OUTDIR := $(HOMEDIR)/output # Get the go environment required for compilation export GOENV = $(HOMEDIR)/go.env -GO := GO111MODULE=on go +GO := GO111MODULE=on go +GOPATH := $(shell $(GO) env GOPATH) GOMOD := $(GO) mod GOBUILD := $(GO) build GOTEST := $(GO) test -race -timeout 30s -gcflags="-N -l" @@ -36,40 +37,36 @@ COVHTML := $(HOMEDIR)/covhtml.html # HTML representation of coverage profile # make, make all all: prepare compile package -print-env: - $(GO) env +set-env: + $(GO) env -w GO111MODULE=on #make prepare, download dependencies prepare: gomod -gomod: print-env - $(GOMOD) download -x || $(GOMOD) download -x +gomod: set-env + $(GOMOD) download #make compile compile: build build: - $(GOBUILD) -o $(HOMEDIR)/client-go - + $(GOBUILD) -o $(HOMEDIR)/hugegraph-client-go # make test, test your code test: prepare test-case test-case: - $(GOTEST) -v -cover $(GOPKGS) + $(GOTEST) -v -cover $(GOPKGS) # make package package: package-bin package-bin: - rm -rf $(OUTDIR) - mkdir -p $(OUTDIR) - mv client-go $(OUTDIR)/ - + rm -rf $(OUTDIR) + mkdir -p $(OUTDIR) + mv hugegraph-client-go $(OUTDIR)/ # make clean clean: - $(GO) clean - rm -rf $(OUTDIR) - rm -rf $(HOMEDIR)/client-go - rm -rf $(GOPATH)/pkg/darwin_amd64 - + $(GO) clean + rm -rf $(OUTDIR) + rm -rf $(GOPATH)/pkg/darwin_amd64 # avoid filename conflict and speed up build .PHONY: all prepare compile test package clean build diff --git a/hugegraph-client-go/api/v1/api.veretx.create.go b/hugegraph-client-go/api/v1/api.veretx.create.go index 12e2a94fd..e4a7d536c 100644 --- a/hugegraph-client-go/api/v1/api.veretx.create.go +++ b/hugegraph-client-go/api/v1/api.veretx.create.go @@ -20,14 +20,14 @@ import ( "context" "encoding/json" "fmt" - "hugegraph.apache.org/client-go/hgtransport" - "hugegraph.apache.org/client-go/internal/model" "io" "io/ioutil" "log" "net/http" "hugegraph.apache.org/client-go/api" + "hugegraph.apache.org/client-go/hgtransport" + "hugegraph.apache.org/client-go/internal/model" ) // ----- API Definition ------------------------------------------------------- diff --git a/hugegraph-client-go/api/v1/api.veretx.create_test.go b/hugegraph-client-go/api/v1/api.veretx.create_test.go index bbb915299..a3483126a 100644 --- a/hugegraph-client-go/api/v1/api.veretx.create_test.go +++ b/hugegraph-client-go/api/v1/api.veretx.create_test.go @@ -15,30 +15,32 @@ * under the License. */ -package v1 +package v1_test import ( "fmt" - hugegraph "hugegraph.apache.org/client-go" - "hugegraph.apache.org/client-go/internal/model" "log" "testing" + + hugegraph "hugegraph.apache.org/client-go" + "hugegraph.apache.org/client-go/internal/model" ) type Model struct { X string } -func testDo(t *testing.T) { - m := Model{X: "1"} +func testVertexCreate_Do(t *testing.T) { client, err := hugegraph.NewDefaultCommonClient() if err != nil { log.Println(err) } v := &model.Vertex[any]{ - ID: "1", - Label: "lemma", - Properties: m, + ID: "1", + Label: "lemma", + Properties: Model{ + X: "1", + }, } resp, err := client.Vertex.Create( client.Vertex.Create.WithVertex(v), diff --git a/hugegraph-client-go/api/v1/api.version_test.go b/hugegraph-client-go/api/v1/api.version_test.go index 5dae42b4f..fbd7a8024 100644 --- a/hugegraph-client-go/api/v1/api.version_test.go +++ b/hugegraph-client-go/api/v1/api.version_test.go @@ -19,7 +19,6 @@ package v1_test import ( "context" - "io" "reflect" "testing"