From e6597d61394bd4dca86e00452dd46b7c371d0a94 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Mon, 27 Apr 2020 14:04:53 +0200 Subject: [PATCH] Don't cd into a directory before building We pass the directory to build to the `go build` command --- Makefile | 14 +++++++------- cli/cmd/context.go | 3 ++- context/store/store_test.go | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7286a142b..87186234e 100644 --- a/Makefile +++ b/Makefile @@ -40,20 +40,20 @@ protos: @protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS} cli: protos - cd cli && GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o ../bin/docker + GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o bin/docker ./cli example: protos cd example/backend && go build -v -o ../../bin/backend-example xcli: cli - cd cmd && GOOS=linux GOARCH=amd64 go build -v -o ../bin/docker-linux-amd64 - cd cmd && GOOS=darwin GOARCH=amd64 go build -v -o ../bin/docker-darwin-amd64 - cd cmd && GOOS=windows GOARCH=amd64 go build -v -o ../bin/docker-windows-amd64.exe + GOOS=linux GOARCH=amd64 go build -v -o bin/docker-linux-amd64 ./cli + GOOS=darwin GOARCH=amd64 go build -v -o bin/docker-darwin-amd64 ./cli + GOOS=windows GOARCH=amd64 go build -v -o bin/docker-windows-amd64.exe ./cli xexample: example - cd example/backend && GOOS=linux GOARCH=amd64 go build -v -o ../../bin/backend-example-linux-amd64 - cd example/backend && GOOS=darwin GOARCH=amd64 go build -v -o ../../bin/backend-example-darwin-amd64 - cd example/backend && GOOS=windows GOARCH=amd64 go build -v -o ../../bin/backend-example-windows-amd64.exe + GOOS=linux GOARCH=amd64 go build -v -o bin/backend-example-linux-amd64 ./example/backend + GOOS=darwin GOARCH=amd64 go build -v -o bin/backend-example-darwin-amd64 ./example/backend + GOOS=windows GOARCH=amd64 go build -v -o bin/backend-example-windows-amd64.exe ./example/backend dprotos: docker build . \ diff --git a/cli/cmd/context.go b/cli/cmd/context.go index 8e8041fe3..eff416e1a 100644 --- a/cli/cmd/context.go +++ b/cli/cmd/context.go @@ -61,7 +61,7 @@ type createOpts struct { func createCommand() *cobra.Command { var opts createOpts cmd := &cobra.Command{ - Use: "create", + Use: "create CONTEXT BACKEND [OPTIONS]", Short: "Create a context", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -78,6 +78,7 @@ func listCommand() *cobra.Command { cmd := &cobra.Command{ Use: "list", Aliases: []string{"ls"}, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { return runList(cmd.Context()) }, diff --git a/context/store/store_test.go b/context/store/store_test.go index b853de4fc..d424e078b 100644 --- a/context/store/store_test.go +++ b/context/store/store_test.go @@ -87,6 +87,7 @@ func (suite *StoreTestSuite) TestGet() { assert.Equal(suite.T(), "description", m.Description) assert.Equal(suite.T(), "type", m.Type) } + func (suite *StoreTestSuite) TestList() { err := suite.store.Create("test1", TypeContext{}, nil) assert.Nil(suite.T(), err)