Initial import
This commit is contained in:
commit
c89a757fe9
2 changed files with 88 additions and 0 deletions
65
Makefile
Normal file
65
Makefile
Normal file
|
@ -0,0 +1,65 @@
|
|||
ifeq ($(origin VERSION), undefined)
|
||||
VERSION != git rev-parse --short HEAD
|
||||
endif
|
||||
|
||||
PREFIX=/usr/local
|
||||
|
||||
HOST_GOOS=$(shell go env GOOS)
|
||||
HOST_GOARCH=$(shell go env GOARCH)
|
||||
# GOOS=windows GOARCH=386
|
||||
|
||||
NAME=vedecom-ukko
|
||||
REPO_PATH=bitbucket.com/glenux-corp/vedecom-ukko
|
||||
BUILD_DIR=$(shell pwd)/_build
|
||||
INSTALL_DIR=$(PREFIX)/bin
|
||||
SHARE_DIR=$(PREFIX)/share/$(NAME)
|
||||
|
||||
all: build
|
||||
|
||||
build: vendor ## build executable
|
||||
@mkdir -p "$(BUILD_DIR)"
|
||||
# go build -i ./...
|
||||
# GOBIN="$(BUILD_DIR)" go install ./...
|
||||
for binary in "./cmd"/* ; do \
|
||||
name="$$(basename "$$binary")" ; \
|
||||
go build -i "$$binary" || exit 1 ; \
|
||||
if [ -f "$$name.exe" ]; then \
|
||||
mv "$$name.exe" "$(BUILD_DIR)/$$name.exe" || exit 1 ; \
|
||||
else \
|
||||
mv "$$name" "$(BUILD_DIR)/$$name" || exit 1 ; \
|
||||
fi ; \
|
||||
done
|
||||
|
||||
|
||||
install:
|
||||
install -g root -o root -m 644 -D Procfile "$(SHARE_DIR)"/Procfile
|
||||
for binary in "$(BUILD_DIR)"/* ; do \
|
||||
name="$$(basename "$$binary")" ; \
|
||||
install -g root -o root -m 0755 -D $$binary "$(INSTALL_DIR)"/$$name || exit 1 ; \
|
||||
done
|
||||
echo "INSTALL_DIR=$(INSTALL_DIR)" > "$(SHARE_DIR)"/env.production
|
||||
|
||||
uninstall:
|
||||
for binary in "$(BUILD_DIR)"/* ; do \
|
||||
name="$$(basename "$$binary")" ; \
|
||||
rm -f "$(INSTALL_DIR)/$$name" || exit 1 ; \
|
||||
done
|
||||
rm -fr "$(SHARE_DIR)
|
||||
|
||||
vendor: ## prepare build tools & vendor dependencies
|
||||
go mod download
|
||||
.PHONY: vendor
|
||||
|
||||
help: ## print this help
|
||||
@echo "Usage: make <target>"
|
||||
@echo ""
|
||||
@echo "With one of following targets:"
|
||||
@awk 'BEGIN {FS = ":.*?## "} \
|
||||
/^[a-zA-Z_-]+:.*?## / \
|
||||
{ sub("\\\\n",sprintf("\n%22c"," "), $$2); \
|
||||
printf("\033[36m%-20s\033[0m %s\n", $$1, $$2); \
|
||||
}' $(MAKEFILE_LIST)
|
||||
|
||||
clean: ## remove build artifacts
|
||||
rm -rf "$(BUILD_DIR)"/*
|
||||
|
23
cmd/randomedit/main.go
Normal file
23
cmd/randomedit/main.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
list := []string{}
|
||||
err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
list = append(list, path)
|
||||
return nil
|
||||
})
|
||||
fmt.Printf("%#v\n", list)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue