Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PREFIX?=$(shell pwd)
BUILDTAGS=

VERSION = 0.2.0

.PHONY: clean all fmt vet lint build test install static
.DEFAULT: default

all: clean build fmt lint test vet install

build:
@echo "+ $@"
@go build -tags "$(BUILDTAGS) cgo" -ldflags "-w -extldflags -static -X main.version=$(VERSION)" -o untrak .

static:
@echo "+ $@"
CGO_ENABLED=1 go build -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.version=$(VERSION)" -o untrak .

fmt:
@echo "+ $@"
@gofmt -s -l . | grep -v vendor | tee /dev/stderr

lint:
@echo "+ $@"
@golint ./... | grep -v vendor | tee /dev/stderr

test: fmt lint vet
@echo "+ $@"
@go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor)

vet:
@echo "+ $@"
@go vet $(shell go list ./... | grep -v vendor)

clean:
@echo "+ $@"
@rm -rf untrack

install:
@echo "+ $@"
@go install .
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"log"
"os"
"strings"
Expand All @@ -16,12 +17,28 @@ import (
"github.com/yanc0/untrak/config"
)

const (
// BANNER is what is printed for help/info output.
BANNER = "Untrack - %s\n"
)

var (
// version indicates which version of the binary is running.
version string
)

func main() {
// Flags, command line parameters
var cfgPathOpt = flag.String("config", "./untrak.yaml", "untrak Config Path")
var outputOpt = flag.String("o", "text", "Output format")
var versionOpt = flag.Bool("version", false, "Print version of the application")
flag.Parse()

if *versionOpt {
fmt.Printf("%s\n", version)
os.Exit(0)
}

var wg sync.WaitGroup
var resourcesIn []*kubernetes.Resource
var resourcesOut []*kubernetes.Resource
Expand Down