Merge branch 'master' of personal.github.com:BBVA/kapow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
.PHONY: lint build test race coverage install acceptance deps
|
||||
.PHONY: lint build test jaillover race coverage install acceptance deps
|
||||
|
||||
GOCMD=go
|
||||
GOBUILD=$(GOCMD) build
|
||||
@@ -6,6 +6,7 @@ GOGET=$(GOCMD) get
|
||||
GOTEST=$(GOCMD) test
|
||||
GOTOOL=$(GOCMD) tool
|
||||
GOLANGLINT=golangci-lint
|
||||
PROJECTREPO=github.com/BBVA/kapow
|
||||
|
||||
BUILD_DIR=./build
|
||||
OUTPUT_DIR=./output
|
||||
@@ -22,9 +23,12 @@ build: deps
|
||||
mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -v
|
||||
|
||||
test: build
|
||||
test: build jaillover
|
||||
$(GOTEST) -v -coverprofile=$(TMP_DIR)/c.out ./...
|
||||
|
||||
jaillover:
|
||||
$(GOGET) $(PROJECTREPO)/testutils/$@
|
||||
|
||||
race: build
|
||||
$(GOTEST) -race -v ./...
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Output struct {
|
||||
Cmdline []string `json:"cmdline"`
|
||||
Env map[string]string `json:"env"`
|
||||
}
|
||||
|
||||
func getEnvMap() map[string]string {
|
||||
env := make(map[string]string)
|
||||
for _, e := range os.Environ() {
|
||||
s := strings.SplitN(e, "=", 2)
|
||||
env[s[0]] = s[1]
|
||||
}
|
||||
return env
|
||||
}
|
||||
|
||||
func main() {
|
||||
o := Output{
|
||||
Cmdline: os.Args,
|
||||
Env: getEnvMap(),
|
||||
}
|
||||
res, err := json.Marshal(o)
|
||||
if err != nil {
|
||||
log.Fatalf("JSON marshal failed %+v", err)
|
||||
}
|
||||
fmt.Println(string(res))
|
||||
}
|
||||
Reference in New Issue
Block a user