Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for mcs build to trim gopaths #60

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)

default: mcs

.PHONY: mcs
mcs:
@echo "Building mcs binary to './mcs'"
@(CGO_ENABLED=0 go build --tags=kqueue --ldflags "-s -w" -o mcs ./cmd/mcs)
@(CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o mcs ./cmd/mcs)

install: mcs
@echo "Installing mcs binary to '$(GOPATH)/bin/mcs'"
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/mcs $(GOPATH)/bin/mcs
@echo "Installation successful. To learn more, try \"mcs --help\"."

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

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

test:
@(go test ./restapi -v)
@(go test -race -v github.com/minio/mcs/restapi/...)

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

clean:
@echo "Cleaning up all the generated files"
@find . -name '*.test' | xargs rm -fv
@find . -name '*~' | xargs rm -fv
@rm -vf mcs
3 changes: 1 addition & 2 deletions cmd/mcs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ VERSION:

var appCmds = []cli.Command{
serverCmd,
versionCmd,
}

func newApp(name string) *cli.App {
Expand Down Expand Up @@ -106,7 +105,7 @@ func newApp(name string) *cli.App {
app.Name = name
app.Version = pkg.Version
app.Author = "MinIO, Inc."
app.Usage = "mcs COMMAND"
app.Usage = "mcs"
app.Description = `MinIO Console Server`
app.Commands = commands
app.HideHelpCommand = true // Hide `help, h` command, we already have `minio --help`.
Expand Down
37 changes: 0 additions & 37 deletions cmd/mcs/version.go

This file was deleted.