Skip to content

Commit adcbf61

Browse files
add support for mcs build to trim gopaths (#60)
also remove `version` sub-command as we don't use this anymore, just use `mcs --version`
1 parent e197399 commit adcbf61

File tree

3 files changed

+16
-44
lines changed

3 files changed

+16
-44
lines changed

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
PWD := $(shell pwd)
2+
GOPATH := $(shell go env GOPATH)
3+
14
default: mcs
25

36
.PHONY: mcs
47
mcs:
58
@echo "Building mcs binary to './mcs'"
6-
@(CGO_ENABLED=0 go build --tags=kqueue --ldflags "-s -w" -o mcs ./cmd/mcs)
9+
@(CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o mcs ./cmd/mcs)
10+
11+
install: mcs
12+
@echo "Installing mcs binary to '$(GOPATH)/bin/mcs'"
13+
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/mcs $(GOPATH)/bin/mcs
14+
@echo "Installation successful. To learn more, try \"mcs --help\"."
715

816
swagger-gen:
917
@echo "Generating swagger server code from yaml"
1018
@swagger generate server -A mcs --main-package=mcs --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
1119

12-
build:
20+
assets:
1321
@(cd portal-ui; yarn install; make build-static; cd ..)
14-
@(CGO_ENABLED=0 go build --tags kqueue --ldflags "-s -w" -o mcs ./cmd/mcs)
1522

1623
test:
17-
@(go test ./restapi -v)
24+
@(go test -race -v github.com/minio/mcs/restapi/...)
1825

1926
coverage:
20-
@(go test ./restapi -v -coverprofile=coverage.out && go tool cover -html=coverage.out && open coverage.html)
27+
@(go test -v -coverprofile=coverage.out github.com/minio/mcs/restapi/... && go tool cover -html=coverage.out && open coverage.html)
2128

2229
clean:
30+
@echo "Cleaning up all the generated files"
31+
@find . -name '*.test' | xargs rm -fv
32+
@find . -name '*~' | xargs rm -fv
2333
@rm -vf mcs

cmd/mcs/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ VERSION:
5353

5454
var appCmds = []cli.Command{
5555
serverCmd,
56-
versionCmd,
5756
}
5857

5958
func newApp(name string) *cli.App {
@@ -106,7 +105,7 @@ func newApp(name string) *cli.App {
106105
app.Name = name
107106
app.Version = pkg.Version
108107
app.Author = "MinIO, Inc."
109-
app.Usage = "mcs COMMAND"
108+
app.Usage = "mcs"
110109
app.Description = `MinIO Console Server`
111110
app.Commands = commands
112111
app.HideHelpCommand = true // Hide `help, h` command, we already have `minio --help`.

cmd/mcs/version.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)