From 158ec3e3b870fd57a445764f1ea8383eaa938098 Mon Sep 17 00:00:00 2001 From: Hiroshi Hayakawa Date: Fri, 24 Dec 2021 01:32:28 +0900 Subject: [PATCH] Installation with "go install" (#3) --- Makefile | 29 +++++++++++++++---- README.md | 7 +++++ .../main.go} | 0 3 files changed, 30 insertions(+), 6 deletions(-) rename cmd/{kubectl-realname-diff.go => kubectl-realname_diff/main.go} (100%) diff --git a/Makefile b/Makefile index b1d3737..2f9972a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,28 @@ -SOURCES := $(shell find . -name '*.go') -BINARY := kubectl-realname_diff +# This Makefile assumed to be used for local development. +GO ?= go +STATICCHECK ?= staticcheck +DIST_DIR := dist -build: kubectl-realname_diff +.PHONY: build +build: + $(GO) build -o $(DIST_DIR)/kubectl-realname_diff cmd/kubectl-realname_diff/main.go -$(BINARY): $(SOURCES) - GO111MODULE=on CGO_ENABLED=0 go build -o $(BINARY) ./cmd/kubectl-realname-diff.go +.PHONY: test +test: vet fmt lint + $(GO) test ./... + +.PHONY: vet +vet: + $(GO) vet ./... + +.PHONY: fmt +fmt: + $(GO) fmt ./... + +.PHONY: lint +lint: + $(STATICCHECK) ./... .PHONY: clean clean: - rm $(BINARY) + rm -rf $(DIST_DIR) diff --git a/README.md b/README.md index eab4587..24a8545 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,13 @@ diff -u -N /var/folders/2n/lgqgy6f151l5mw1x4dj_7ztw0000gn/T/LIVE-116798495/v1.Co For a complete example, see the [example directory](./example). +## Installation +Use go install as follows: + +``` +$ go install github.com/hhiroshell/cmd/kubectl-realname_diff@latest +``` + ## License Kubectl Real Name Diff is licensed under the Apache License 2.0, and includes works distributed under same one. diff --git a/cmd/kubectl-realname-diff.go b/cmd/kubectl-realname_diff/main.go similarity index 100% rename from cmd/kubectl-realname-diff.go rename to cmd/kubectl-realname_diff/main.go