From 8758d5b48d94bf3d73d998e32b7b0880b62947a2 Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Thu, 4 Apr 2019 08:08:09 +0200 Subject: [PATCH] cleanup and add travis --- .travis.yml | 23 +++++++++++++++++++++++ Makefile | 13 +++++-------- main.go | 4 +--- 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..05e96490 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +dist: xenial + +language: go + +env: + - GO111MODULE=on + +go: + - 1.12.x + - master + +git: + depth: 1 + +install: true + +before_script: + - go install github.com/golangci/golangci-lint/cmd/golangci-lint + - go install github.com/mitchellh/gox + +script: + - golangci-lint run + - make fmt check build-cross \ No newline at end of file diff --git a/Makefile b/Makefile index 61ecb0f0..0f3f2545 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,14 @@ GOFLAGS := BINDIR := $(CURDIR)/bin BINARIES := k3d +export GO111MODULE=on + # go source files, ignore vendor directory SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*") -.PHONY: all build build-cross clean install uninstall fmt simplify check run bootstrap +.PHONY: all build build-cross clean fmt simplify check bootstrap -all: check install +all: check build build: $(GO) build -i $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)' @@ -44,14 +46,9 @@ check: @go vet ${SRC} # Check for required executables -HAS_GOX := $(shell command -v gox;) -HAS_GIT := $(shell command -v git;) +HAS_GOX := $(shell command -v gox 2> /dev/null) bootstrap: ifndef HAS_GOX go get -u github.com/mitchellh/gox -endif - -ifndef HAS_GIT - $(error You must install Git) endif \ No newline at end of file diff --git a/main.go b/main.go index 7aeabcb8..3d0738a0 100644 --- a/main.go +++ b/main.go @@ -28,9 +28,7 @@ func createCluster(c *cli.Context) error { extraArgs = append(extraArgs, "--volume", c.String("volume")) } if len(extraArgs) > 0 { - for _, extra := range extraArgs { - args = append(args, extra) - } + args = append(args, extraArgs...) } args = append(args, "-d",