Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
add fmt target and make build target depends on it
Browse files Browse the repository at this point in the history
  • Loading branch information
andyxning committed Nov 30, 2016
1 parent 2b7acdf commit 6881c24
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ TEST_NAMESPACE = heapster-e2e-tests
deps:
which godep || go get github.com/tools/godep

build: clean deps
fmt:
find . -type f -name "*.go" | grep -v "./vendor*" | xargs gofmt -s -w

build: clean deps fmt
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags "-w -X k8s.io/heapster/version.HeapsterVersion=$(VERSION) -X k8s.io/heapster/version.GitCommit=$(GIT_COMMIT)" -o heapster k8s.io/heapster/metrics
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags "-w -X k8s.io/heapster/version.HeapsterVersion=$(VERSION) -X k8s.io/heapster/version.GitCommit=$(GIT_COMMIT)" -o eventer k8s.io/heapster/events

Expand Down
6 changes: 3 additions & 3 deletions metrics/processors/pod_based_enricher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

var batches = []*core.DataBatch{
&core.DataBatch{
{
Timestamp: time.Now(),
MetricSets: map[string]*core.MetricSet{
core.PodContainerKey("ns1", "pod1", "c1"): {
Expand All @@ -51,7 +51,7 @@ var batches = []*core.DataBatch{
},
},
},
&core.DataBatch{
{
Timestamp: time.Now(),
MetricSets: map[string]*core.MetricSet{
core.PodContainerKey("ns1", "pod1", "c1"): {
Expand All @@ -65,7 +65,7 @@ var batches = []*core.DataBatch{
},
},
},
&core.DataBatch{
{
Timestamp: time.Now(),
MetricSets: map[string]*core.MetricSet{
core.PodKey("ns1", "pod1"): {
Expand Down
8 changes: 4 additions & 4 deletions metrics/processors/rate_calculator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ func TestRateCalculator(t *testing.T) {
core.LabelMetricSetType.Key: core.MetricSetTypePodContainer,
},
MetricValues: map[string]core.MetricValue{
core.MetricCpuUsage.MetricDescriptor.Name: core.MetricValue{
core.MetricCpuUsage.MetricDescriptor.Name: {
ValueType: core.ValueInt64,
MetricType: core.MetricCumulative,
IntValue: 947130377781,
},
core.MetricNetworkTxErrors.MetricDescriptor.Name: core.MetricValue{
core.MetricNetworkTxErrors.MetricDescriptor.Name: {
ValueType: core.ValueInt64,
MetricType: core.MetricCumulative,
IntValue: 0,
Expand All @@ -65,12 +65,12 @@ func TestRateCalculator(t *testing.T) {
core.LabelMetricSetType.Key: core.MetricSetTypePodContainer,
},
MetricValues: map[string]core.MetricValue{
core.MetricCpuUsage.MetricDescriptor.Name: core.MetricValue{
core.MetricCpuUsage.MetricDescriptor.Name: {
ValueType: core.ValueInt64,
MetricType: core.MetricCumulative,
IntValue: 948071062732,
},
core.MetricNetworkTxErrors.MetricDescriptor.Name: core.MetricValue{
core.MetricNetworkTxErrors.MetricDescriptor.Name: {
ValueType: core.ValueInt64,
MetricType: core.MetricCumulative,
IntValue: 120,
Expand Down
4 changes: 2 additions & 2 deletions metrics/sinks/monasca/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ var testInput = &core.DataBatch{
MetricSets: map[string]*core.MetricSet{
"set1": {
MetricValues: map[string]core.MetricValue{
"m2": core.MetricValue{ValueType: core.ValueInt64, IntValue: 2 ^ 63},
"m3": core.MetricValue{ValueType: core.ValueFloat, FloatValue: -1023.0233},
"m2": {ValueType: core.ValueInt64, IntValue: 2 ^ 63},
"m3": {ValueType: core.ValueFloat, FloatValue: -1023.0233},
},
Labels: map[string]string{
core.LabelHostname.Key: "h1",
Expand Down
2 changes: 1 addition & 1 deletion metrics/sinks/opentsdb/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func generateMetricSet(name string, metricType core.MetricType, value int64) *co
return &core.MetricSet{
Labels: fakeLabel,
MetricValues: map[string]core.MetricValue{
name: core.MetricValue{
name: {
MetricType: metricType,
ValueType: core.ValueInt64,
IntValue: value,
Expand Down
14 changes: 7 additions & 7 deletions metrics/sources/kubelet/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,31 +255,31 @@ func TestDecodeMetrics6(t *testing.T) {
LoadAverage: 20,
},
CustomMetrics: map[string][]cadvisor_api.MetricVal{
"test1": []cadvisor_api.MetricVal{
"test1": {
{
Label: "test1",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test2": []cadvisor_api.MetricVal{
"test2": {
{
Label: "test2",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test3": []cadvisor_api.MetricVal{
"test3": {
{
Label: "test3",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test4": []cadvisor_api.MetricVal{
"test4": {
{
Label: "test4",
Timestamp: time.Now(),
Expand All @@ -297,7 +297,7 @@ func TestDecodeMetrics6(t *testing.T) {
}

var nodes = []kube_api.Node{
kube_api.Node{
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Expand All @@ -320,7 +320,7 @@ var nodes = []kube_api.Node{
},
},
},
kube_api.Node{
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Expand All @@ -343,7 +343,7 @@ var nodes = []kube_api.Node{
},
},
},
kube_api.Node{
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Expand Down

0 comments on commit 6881c24

Please sign in to comment.