Browse Source

update makefile to work with busybox

master
Richard Hillmann 9 years ago
parent
commit
d39302183b
  1. 16
      Makefile
  2. 6
      exporter.go
  3. 5
      exporter_test.go

16
Makefile

@ -1,11 +1,15 @@
GO := GO15VENDOREXPERIMENT=1 go GO := GO15VENDOREXPERIMENT=1 go
pkgs = $(shell $(GO) list ./... | grep -v /vendor/) pkgs = .
DOCKER_IMAGE_NAME ?= exporter DOCKER_IMAGE_NAME ?= exporter
DOCKER_IMAGE_TAG ?= latest DOCKER_IMAGE_TAG ?= latest
all: format build test all: get format test build
get:
@echo ">> get dependencies"
@$(GO) get
style: style:
@echo ">> checking code style" @echo ">> checking code style"
@ -19,16 +23,12 @@ format:
@echo ">> formatting code" @echo ">> formatting code"
@$(GO) fmt $(pkgs) @$(GO) fmt $(pkgs)
vet:
@echo ">> vetting code"
@$(GO) vet $(pkgs)
build: build:
@echo ">> building binaries" @echo ">> building binaries"
@$(GO) build -o exporter @$(GO) build -tags netgo -a -o exporter
docker: docker:
@echo ">> building docker image" @echo ">> building docker image"
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
.PHONY: all style format build test vet docker .PHONY: all get style format test build docker

6
exporter.go

@ -6,6 +6,8 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url"
"strings"
"syscall" "syscall"
"time" "time"
@ -13,8 +15,6 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/log" "github.com/prometheus/common/log"
"github.com/prometheus/common/version" "github.com/prometheus/common/version"
"net/url"
"strings"
) )
const ( const (
@ -137,8 +137,6 @@ func (s *appScraper) stats() (*AppStats, error) {
return nil, fmt.Errorf("Invalid JSON returned, could not retreive duration.*") return nil, fmt.Errorf("Invalid JSON returned, could not retreive duration.*")
} }
return &stats, err return &stats, err
} }

5
exporter_test.go

@ -1,11 +1,11 @@
package main package main
import ( import (
"testing"
"net/http/httptest"
"fmt" "fmt"
"net/http" "net/http"
"net/http/httptest"
"reflect" "reflect"
"testing"
) )
func TestScraper(t *testing.T) { func TestScraper(t *testing.T) {
@ -48,7 +48,6 @@ func TestScraper(t *testing.T) {
Count: 91905, Count: 91905,
Sum: 4484.3037570333245, Sum: 4484.3037570333245,
Average: 0.024613801985478054, Average: 0.024613801985478054,
}, },
}, },
ok: true, ok: true,

Loading…
Cancel
Save