File tree Expand file tree Collapse file tree 8 files changed +634
-14
lines changed
boilerplate-repo/boilerplate Expand file tree Collapse file tree 8 files changed +634
-14
lines changed Original file line number Diff line number Diff line change 5
5
6
6
# Using go1.10.4
7
7
FROM golang:1.10.4-alpine3.8 as builder
8
- RUN apk add git openssh-client make curl dep
8
+ RUN apk add git openssh-client make curl
9
9
10
- # COPY only the dep files for efficient caching
11
- COPY Gopkg.* /go/src/github.com/lyft/{{REPOSITORY}}/
10
+ # COPY only the go mod files for efficient caching
11
+ COPY go.mod go.sum /go/src/github.com/lyft/{{REPOSITORY}}/
12
12
WORKDIR /go/src/github.com/lyft/{{REPOSITORY}}
13
13
14
14
# Pull dependencies
15
- RUN dep ensure -vendor-only
15
+ RUN go mod download
16
16
17
17
# COPY the rest of the source code
18
18
COPY . /go/src/github.com/lyft/{{REPOSITORY}}/
Original file line number Diff line number Diff line change
1
+ module github.com/lyft/boilerplate
2
+
3
+ go 1.13
4
+
5
+ require (
6
+ github.com/golangci/golangci-lint v1.22.2
7
+ github.com/lyft/flytestdlib v0.2.31
8
+ github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
9
+ github.com/alvaroloes/enumer v1.1.2
10
+ )
11
+
12
+ replace github.com/vektra/mockery => github.com/enghabu/mockery v0.0.0-20191009061720-9d0c8670c2f0
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ // +build tools
2
+
3
+ package tools
4
+
5
+ import (
6
+ _ "github.com/golangci/golangci-lint/cmd/golangci-lint"
7
+ _ "github.com/lyft/flytestdlib/cli/pflags"
8
+ _ "github.com/vektra/mockery/cmd/mockery"
9
+ _ "github.com/alvaroloes/enumer"
10
+ )
Original file line number Diff line number Diff line change 1
1
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
2
2
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
3
- #
3
+ #
4
4
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
5
5
6
- DEP_SHA =1f7c19e5f52f49ffb9f956f64c010be14683468b
6
+
7
+ .PHONY : download_tooling
8
+ download_tooling : # download dependencies (including test deps) for the package
9
+ @boilerplate/lyft/golang_test_targets/download_tooling.sh
7
10
8
11
.PHONY : lint
9
- lint : # lints the package for common code smells
10
- which golangci-lint || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $$ GOPATH/bin v1.16.0
11
- golangci-lint run --exclude deprecated
12
+ lint : download_tooling # lints the package for common code smells
13
+ GL_DEBUG=linters_output,env golangci-lint run --deadline=5m --exclude deprecated -v
12
14
13
15
# If code is failing goimports linter, this will fix.
14
16
# skips 'vendor'
15
17
.PHONY : goimports
16
18
goimports :
17
19
@boilerplate/lyft/golang_test_targets/goimports
18
20
21
+ .PHONY : mod_download
22
+ mod_download : # download dependencies (including test deps) for the package
23
+ go mod download
24
+
19
25
.PHONY : install
20
- install : # download dependencies (including test deps) for the package
21
- which dep || (curl " https://raw.githubusercontent.com/golang/dep/${DEP_SHA} /install.sh" | sh)
22
- dep ensure
26
+ install : download_tooling mod_download
27
+
28
+ .PHONY : show
29
+ show : go list -m all
23
30
24
31
.PHONY : test_unit
25
32
test_unit :
@@ -36,3 +43,4 @@ test_unit_cover:
36
43
.PHONY : test_unit_visual
37
44
test_unit_visual :
38
45
go test ./... -coverprofile /tmp/cover.out -covermode=count; go tool cover -html=/tmp/cover.out
46
+
Original file line number Diff line number Diff line change 1
1
Golang Test Targets
2
2
~~~~~~~~~~~~~~~~~~~
3
3
4
- Provides an ``install `` make target that uses ``dep `` install golang dependencies.
4
+ Provides an ``install `` make target that uses ``go mod `` to install golang dependencies.
5
5
6
6
Provides a ``lint `` make target that uses golangci to lint your code.
7
7
@@ -17,7 +17,7 @@ Provides a ``test_benchmark`` target for benchmark tests.
17
17
18
18
Add ``lyft/golang_test_targets `` to your ``boilerplate/update.cfg `` file.
19
19
20
- Make sure you're using ``dep `` for dependency management.
20
+ Make sure you're using ``go mod `` for dependency management.
21
21
22
22
Provide a ``.golangci `` configuration (the lint target requires it).
23
23
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Everything in this file needs to be installed outside of current module
4
+ # The reason we cannot turn off module entirely and install is that we need the replace statement in go.mod
5
+ # because we are installing a mockery fork. Turning it off would result installing the original not the fork.
6
+ # We also want to version all the other tools. We also want to be able to run go mod tidy without removing the version
7
+ # pins. To facilitate this, we're maintaining two sets of go.mod/sum files - the second one only for tooling. This is
8
+ # the same approach that go 1.14 will take as well.
9
+ # See:
10
+ # https://github.com/lyft/flyte/issues/129
11
+ # https://github.com/golang/go/issues/30515 for some background context
12
+ # https://github.com/go-modules-by-example/index/blob/5ec250b4b78114a55001bd7c9cb88f6e07270ea5/010_tools/README.md
13
+
14
+ set -e
15
+
16
+ # List of tools to go get
17
+ # In the format of "<cli>:<package>" or ":<package>" if no cli
18
+ tools=(
19
+ " github.com/vektra/mockery/cmd/mockery"
20
+ " github.com/lyft/flytestdlib/cli/pflags"
21
+ " github.com/golangci/golangci-lint/cmd/golangci-lint"
22
+ " github.com/alvaroloes/enumer"
23
+ )
24
+
25
+ tmp_dir=$( mktemp -d -t gotooling-XXX)
26
+ echo " Using temp directory ${tmp_dir} "
27
+ cp -R boilerplate/lyft/golang_support_tools/* $tmp_dir
28
+ pushd " $tmp_dir "
29
+
30
+ for tool in " ${tools[@]} "
31
+ do
32
+ echo " Installing ${tool} "
33
+ GO111MODULE=on go install $tool
34
+ done
35
+
36
+ popd
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ if [ -z "$REPOSITORY" ]; then
34
34
fi
35
35
36
36
while read directory; do
37
+ # TODO: Skip empty lines, whitespace only lines, and comment lines
37
38
echo " ***********************************************************************************"
38
39
echo " $directory is configured in update.cfg."
39
40
echo " -----------------------------------------------------------------------------------"
You can’t perform that action at this time.
0 commit comments