Skip to content

Commit 797a75e

Browse files
authored
Split into multi modules. (#17)
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
1 parent 06ab997 commit 797a75e

36 files changed

Lines changed: 2578 additions & 1356 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
docker:
66
# Available from https://hub.docker.com/r/circleci/golang/
7-
- image: circleci/golang:1.12.5
7+
- image: circleci/golang:1.16
88
working_directory: /go/src/github.com/bwplotka/mimic
99
environment:
1010
GO111MODULE: 'on'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515

1616
gen
1717
.envrc
18-
vendor
18+
vendor
19+

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
GOBIN ?= ${GOPATH}/bin
2+
GO ?= $(shell which go)
23

34
FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
45

@@ -17,6 +18,14 @@ export GO111MODULE
1718
.PHONY: all
1819
all: format test
1920

21+
.PHONY: update-go-deps
22+
update-go-deps:
23+
@echo ">> updating Go dependencies"
24+
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
25+
$(GO) get $$m; \
26+
done
27+
@$(GO) mod tidy
28+
2029
# check-docs checks if documentation have discrepancy with flags and if the links are valid.
2130
.PHONY: check-docs
2231
check-docs: $(LICHE)
@@ -43,8 +52,11 @@ lint: $(GOLANGCILINT)
4352

4453
.PHONY: test
4554
test:
46-
@echo ">> building binaries"
55+
@echo ">> testing binaries"
4756
@go test ./...
57+
@cd examples/kubernetes-statefulset && go run example.go generate
58+
@cd examples/prometheus-remote-read-benchmark && go run main.go generate
59+
@cd examples/terraform && go run main.go generate
4860

4961
# $(1): Go install path. (e.g github.com/campoy/embedmd)
5062
# $(2): Tag.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module github.com/bwplotka/mimic/examples/kubernetes-statefulset
2+
3+
go 1.16
4+
5+
require (
6+
github.com/bwplotka/mimic v0.0.0-20190730202618-06ab9976e8ef
7+
github.com/go-openapi/swag v0.19.15
8+
k8s.io/api v0.20.5
9+
k8s.io/apimachinery v0.20.5
10+
)
11+
12+
// This module is meant to be executed from repo root.
13+
replace github.com/bwplotka/mimic => ../../

examples/kubernetes-statefulset/go.sum

Lines changed: 510 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module github.com/bwplotka/mimic/examples/prometheus-remote-read-benchmark
2+
3+
go 1.16
4+
5+
require (
6+
github.com/bwplotka/mimic v0.0.0-20190730202618-06ab9976e8ef
7+
github.com/bwplotka/mimic/lib/abstr/kubernetes v0.0.0-20190730202618-06ab9976e8ef
8+
github.com/bwplotka/mimic/lib/schemas/prometheus v0.0.0-20190730202618-06ab9976e8ef
9+
github.com/go-openapi/swag v0.19.15
10+
github.com/prometheus/common v0.20.0
11+
k8s.io/api v0.20.5
12+
k8s.io/apimachinery v0.20.5
13+
)
14+
15+
// This module is meant to be executed from repo root.
16+
replace (
17+
github.com/bwplotka/mimic => ../../
18+
github.com/bwplotka/mimic/lib/abstr/kubernetes => ../../lib/abstr/kubernetes
19+
github.com/bwplotka/mimic/lib/schemas/prometheus => ../../lib/schemas/prometheus
20+
)

examples/prometheus-remote-read-benchmark/go.sum

Lines changed: 539 additions & 0 deletions
Large diffs are not rendered by default.

examples/prometheus-remote-read-benchmark/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/prometheus/common/model"
99

10-
"github.com/bwplotka/mimic/abstractions/kubernetes/volumes"
10+
"github.com/bwplotka/mimic/lib/abstr/kubernetes/volumes"
1111
"github.com/go-openapi/swag"
1212
appsv1 "k8s.io/api/apps/v1"
1313
corev1 "k8s.io/api/core/v1"
@@ -18,7 +18,7 @@ import (
1818

1919
"github.com/bwplotka/mimic"
2020
"github.com/bwplotka/mimic/encoding"
21-
"github.com/bwplotka/mimic/providers/prometheus"
21+
"github.com/bwplotka/mimic/lib/schemas/prometheus"
2222
)
2323

2424
const (
@@ -107,9 +107,8 @@ func genRRTestPrometheus(generator *mimic.Generator, name string, promVersion st
107107
},
108108
},
109109
}))
110-
if err != nil {
111-
mimic.PanicErr(err)
112-
}
110+
mimic.PanicIfErr(err)
111+
113112
promConfigAndMount := volumes.ConfigAndMount{
114113
ObjectMeta: metav1.ObjectMeta{
115114
Name: configVolumeName,

examples/terraform/go.mod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module github.com/bwplotka/mimic/examples/terraform
2+
3+
go 1.16
4+
5+
require (
6+
github.com/bwplotka/mimic v0.0.0-20190730202618-06ab9976e8ef
7+
github.com/kr/text v0.2.0 // indirect
8+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
9+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
10+
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
11+
)
12+
13+
// This module is meant to be executed from repo root.
14+
replace github.com/bwplotka/mimic => ../../

examples/terraform/go.sum

Lines changed: 405 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)