Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Commit 6f05cfd

Browse files
author
Florentin DUBOIS
authored
Merge pull request #61 from FlorentinDUBOIS/chore/dep
chore: update dependencies
2 parents 9e29b8f + 683e0af commit 6f05cfd

File tree

10 files changed

+138
-397
lines changed

10 files changed

+138
-397
lines changed

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
language: go
22
go:
3-
- 1.10.x
4-
- 1.11.x
53
- 1.12.x
64
go_import_path: github.com/ovh/noderig
75
before_install:
8-
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
96
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.15.0
107
script:
11-
- make deps
8+
- make dep
129
- make lint
1310
- make format
1411
- make dist

Gopkg.lock

Lines changed: 0 additions & 208 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 38 deletions
This file was deleted.

Makefile

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
BUILD_DIR=build
1+
NAME := noderig
2+
BUILD_DIR := build
3+
GITHASH := $(shell git rev-parse HEAD)
24

3-
CC=go build
4-
GITHASH=$(shell git rev-parse HEAD)
5-
DFLAGS=-race
6-
CFLAGS=-X github.com/ovh/noderig/cmd.githash=$(GITHASH)
7-
CROSS=GOOS=linux GOARCH=amd64
5+
CC := GO111MODULE=on go build
6+
CROSS := GOOS=linux GOARCH=amd64
7+
DFLAGS := -race
8+
CFLAGS := -i -v -mod vendor
9+
LDFLAGS := -X github.com/ovh/noderig/cmd.githash=$(GITHASH)
810

9-
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
10-
VPATH= $(BUILD_DIR)
11+
rwildcard := $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
1112

12-
LINT_PATHS= ./cmd/... ./collectors/... ./core/... ./
13+
FORMAT_PATHS := ./cmd ./core ./collectors $(NAME).go
14+
MODULE_PATHS := ./cmd/... ./core/... ./collectors/...
15+
FILE_PATHS := $(call rwildcard, cmd, *.go) $(call rwildcard, core, *.go) $(NAME).go
1316

14-
.SECONDEXPANSION:
17+
.PHONY: all
18+
all: init dep format lint release
1519

16-
install:
17-
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
18-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0
20+
.PHONY: init
21+
init:
22+
GO111MODULE=on go get -u -v github.com/golangci/golangci-lint/cmd/golangci-lint
1923

20-
init:
21-
dep init
24+
.PHONY: dep
25+
dep:
26+
GO111MODULE=on go mod vendor -v
2227

23-
deps:
24-
dep ensure -v
28+
.PHONY: fmt
29+
format: $(FILE_PATHS)
30+
gofmt -s -w $(FORMAT_PATHS)
2531

26-
build: noderig.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./collectors, *.go)
27-
$(CC) $(DFLAGS) -ldflags "$(CFLAGS)" -o $(BUILD_DIR)/noderig noderig.go
32+
.PHONY: lint
33+
lint: $(FILE_PATHS)
34+
golangci-lint run
2835

29-
.PHONY: release
30-
release: noderig.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./collectors, *.go)
31-
$(CC) -ldflags "$(CFLAGS)" -o $(BUILD_DIR)/noderig noderig.go
36+
.PHONY: build
37+
build: $(FILE_PATHS)
38+
$(CC) $(CFLAGS) $(DFLAGS) -ldflags '$(LDFLAGS)' -o $(BUILD_DIR)/$(NAME)
3239

33-
.PHONY: dist
34-
dist: noderig.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./collectors, *.go)
35-
$(CROSS) $(CC) -ldflags "$(CFLAGS) -s -w" -o $(BUILD_DIR)/noderig noderig.go
40+
.PHONY: dev
41+
dev: fmt lint build
3642

37-
.PHONY: lint
38-
lint:
39-
$(GOPATH)/bin/golangci-lint run --enable-all \
40-
--disable gochecknoinits \
41-
--disable gochecknoglobals \
42-
--disable scopelint \
43-
--disable goimports \
44-
$(LINT_PATHS)
45-
46-
.PHONY: format
47-
format:
48-
gofmt -w -s ./cmd ./core ./collectors noderig.go
43+
.PHONY: release
44+
release: $(FILE_PATHS)
45+
$(CC) $(CFLAGS) -ldflags '$(LDFLAGS) -s -w' -o $(BUILD_DIR)/$(NAME)
4946

50-
.PHONY: dev
51-
dev: format lint build
47+
.PHONY: dist
48+
dist: $(FILE_PATHS)
49+
$(CROSS) $(CC) $(CFLAGS) -ldflags '$(LDFLAGS) -s -w' -o $(BUILD_DIR)/$(NAME)
5250

5351
.PHONY: clean
5452
clean:
55-
rm -rf $BUILD_DIR
53+
rm -rfv $(BUILD_DIR)
54+
rm -rfv vendor
5655

5756
# Docker build
5857

58+
.PHONY: build-docker
5959
build-docker: build-go-in-docker build-docker-image
6060

61-
go-build-in-docker:
62-
$(CC) -ldflags "$(CFLAGS)" noderig.go
63-
61+
.PHONY: build-go-in-docker
6462
build-go-in-docker:
6563
docker run --rm \
6664
-e GOBIN=/go/bin/ -e CGO_ENABLED=0 -e GOPATH=/go \
6765
-v ${PWD}:/go/src/github.com/ovh/noderig \
6866
-w /go/src/github.com/ovh/noderig \
69-
golang:1.8.0 \
70-
make glide-install go-build-in-docker
67+
golang:1.12.6 \
68+
make
7169

70+
.PHONY: build-docker-image
7271
build-docker-image:
7372
docker build -t ovh/noderig .
7473

74+
.PHONY: run
7575
run:
7676
docker run --rm --net host ovh/noderig

0 commit comments

Comments
 (0)