Skip to content

Commit

Permalink
fix makefile
Browse files Browse the repository at this point in the history
Change-Id: I43aa279f5b2c4006b8cea6faa52be32d19d784ed
  • Loading branch information
izliang committed Oct 25, 2023
1 parent 2ab0e45 commit 580c755
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ tree.txt

# system ignore
Thumbs.db

# client-go
go.env
31 changes: 14 additions & 17 deletions hugegraph-client-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
4 changes: 2 additions & 2 deletions hugegraph-client-go/api/v1/api.veretx.create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------------------------------
Expand Down
18 changes: 10 additions & 8 deletions hugegraph-client-go/api/v1/api.veretx.create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion hugegraph-client-go/api/v1/api.version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1_test

import (
"context"

"io"
"reflect"
"testing"
Expand Down

0 comments on commit 580c755

Please sign in to comment.