Skip to content

Commit e863be3

Browse files
author
Juan Jose Medina
authored
Merge pull request #8 from bitnami/gomod
Use go mod instead of dep
2 parents 3ca40f7 + cfff50d commit e863be3

File tree

8 files changed

+70
-142
lines changed

8 files changed

+70
-142
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/golang:1.10
5+
- image: circleci/golang:1.16
66

77
working_directory: /go/src/github.com/bitnami/ini-file
88
steps:
99
- checkout
1010
- run: make get-build-deps
11-
- run: make dep-ensure
11+
- run: make download
1212
- run: make vet
1313
- run: make lint
1414
- run: make cover
15-
- run: make build
16-
- run: make build/arm64
15+
- run: make build TOOL_PATH=out/ini-file
16+
- run: make build/arm64 TOOL_PATH=out/arm64/ini-file
1717
- store_artifacts:
1818
path: /go/src/github.com/bitnami/ini-file/out/ini-file
1919
destination: ini-file

Dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@
55
# docker run --rm -it -v /tmp:/tmp bitnami/ini-file del -k "title" -s "My book" /tmp/my.ini
66
#
77

8-
FROM golang:1.10-stretch as build
8+
FROM golang:1.16-stretch as build
99

1010
RUN apt-get update && apt-get install -y --no-install-recommends \
1111
git make upx \
1212
&& rm -rf /var/lib/apt/lists/*
1313

14-
RUN wget -q -O dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
15-
echo '287b08291e14f1fae8ba44374b26a2b12eb941af3497ed0ca649253e21ba2f83 dep' | sha256sum -c - && \
16-
mv dep /usr/bin/ && chmod +x /usr/bin/dep
17-
1814
RUN go get -u \
19-
github.com/golang/lint/golint \
15+
golang.org/x/lint/golint \
2016
golang.org/x/tools/cmd/goimports \
21-
github.com/golang/dep/cmd/dep \
2217
&& rm -rf $GOPATH/src/* && rm -rf $GOPATH/pkg/*
2318

2419

Gopkg.lock

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

Gopkg.toml

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

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build clean dep-ensure get-build-deps vet lint get-deps test cover
1+
.PHONY: all build clean download get-build-deps vet lint get-deps test cover
22

33
TOOL_NAME := ini-file
44

@@ -9,29 +9,29 @@ include ./vars.mk
99

1010
all:
1111
@$(MAKE) get-build-deps
12-
$(DEP_ENSURE) -vendor-only
12+
@$(MAKE) download
1313
@$(MAKE) vet
1414
@$(MAKE) lint
1515
@$(MAKE) cover
1616
@$(MAKE) build
1717

18-
build:
19-
@go build -ldflags="-s -w" -o $(TOOL_PATH)
18+
build/%:
19+
@echo "Building GOARCH=$(*F)"
20+
@GOARCH=$(*F) go build -ldflags=$(LDFLAGS) -o $(TOOL_PATH)
21+
@echo "*** Binary created under $(TOOL_PATH) ***"
2022

21-
build/arm64:
22-
@GOARCH=arm64 go build -ldflags="-s -w" -o $(BUILD_DIR)/arm64/$(TOOL_NAME)
23+
build: build/amd64
2324

2425
clean:
2526
@rm -rf $(BUILD_DIR)
2627

27-
dep-ensure:
28-
$(DEP_ENSURE)
28+
download:
29+
$(GO_MOD) download
2930

3031
get-build-deps:
3132
@echo "+ Downloading build dependencies"
3233
@go get golang.org/x/tools/cmd/goimports
33-
@go get github.com/golang/lint/golint
34-
@go get -u github.com/golang/dep/cmd/dep
34+
@go get golang.org/x/lint/golint
3535

3636
vet:
3737
@echo "+ Vet"

go.mod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module github.com/bitnami/ini-file
2+
3+
go 1.16
4+
5+
require (
6+
github.com/bitnami/gonit v0.2.0
7+
github.com/davecgh/go-spew v1.1.1 // indirect
8+
github.com/go-ini/ini v1.62.0
9+
github.com/jessevdk/go-flags v1.5.0
10+
github.com/juamedgod/cliassert v0.0.0-20180320011200-425256f2bb0b
11+
github.com/pmezard/go-difflib v1.0.0 // indirect
12+
github.com/smartystreets/goconvey v1.6.4 // indirect
13+
github.com/stretchr/testify v1.2.2
14+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
15+
gopkg.in/ini.v1 v1.62.0 // indirect
16+
)

go.sum

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
github.com/bitnami/gonit v0.2.0 h1:qrza7cn2/YmX47SCIBKShqtupSNX4KSwaQJL698s2WU=
2+
github.com/bitnami/gonit v0.2.0/go.mod h1:rWUClL7qwHeUIIP7SkokjfvE3RonglnANqJtzUpyHyU=
3+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU=
6+
github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
7+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
8+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
9+
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
10+
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
11+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
12+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
13+
github.com/juamedgod/cliassert v0.0.0-20180320011200-425256f2bb0b h1:j2GwaFh0vduPA3PilmBcsdWv0reobJHyIxGJnh9gIAA=
14+
github.com/juamedgod/cliassert v0.0.0-20180320011200-425256f2bb0b/go.mod h1:+N11eVKRhj1RNqjc9l+QMib0/XYixFOywXFH1zoGucg=
15+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
16+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
17+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
18+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
19+
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
20+
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
21+
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
22+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
23+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
24+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
25+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
26+
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
27+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
28+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
29+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
30+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
31+
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
32+
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

vars.mk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ PATH := $(GOPATH)/bin:$(PATH)
44

55
BUILD_DIR := $(abspath ./out)
66
TOOL_NAME ?= $(shell basename $(CURDIR))
7-
TOOL_PATH := $(BUILD_DIR)/$(TOOL_NAME)
7+
TOOL_PATH ?= $(BUILD_DIR)/$(TOOL_NAME)
8+
9+
BUILD_DATE := $(shell date -u '+%Y-%m-%d %I:%M:%S UTC' 2> /dev/null)
10+
GIT_HASH := $(shell git rev-parse HEAD 2> /dev/null)
11+
LDFLAGS="'main.buildDate=$(BUILD_DATE)' -X main.commit=$(GIT_HASH) -s -w"
812

913
DEBUG ?= 0
1014

@@ -14,7 +18,7 @@ else
1418
GO_TEST := @go test
1519
endif
1620

17-
DEP_ENSURE := @dep ensure
21+
GO_MOD := @go mod
1822
# Do not do goimport of the vendor dir
1923
go_files=$$(find $(1) -type f -name '*.go' -not -path "./vendor/*")
2024
fmtcheck = @if goimports -l $(go_files) | read var; then echo "goimports check failed for $(1):\n `goimports -d $(go_files)`"; exit 1; fi

0 commit comments

Comments
 (0)