-
Notifications
You must be signed in to change notification settings - Fork 12
Gomod Updates #4
Changes from 5 commits
5d954cd
b1ca3bd
2f83015
bb34bf0
ab7afb5
ec91ad7
04e1264
99e0351
1f4c069
4a1fd27
d929928
0307414
95fd5fd
68ee961
33b13bd
1a38b6a
1878f32
19ae2a9
3a35e6f
be1dc60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. | ||
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: | ||
# | ||
# | ||
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst | ||
|
||
DEP_SHA=1f7c19e5f52f49ffb9f956f64c010be14683468b | ||
|
||
.PHONY: lint | ||
lint: #lints the package for common code smells | ||
which golangci-lint || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $$GOPATH/bin v1.16.0 | ||
golangci-lint run --exclude deprecated | ||
which golangci-lint || make download_tooling | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling make from make feels a bit weird. Is there any reason we have to do this? Can we just make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
GL_DEBUG=linters_output,env golangci-lint run --deadline=5m --exclude deprecated -v | ||
|
||
# If code is failing goimports linter, this will fix. | ||
# skips 'vendor' | ||
.PHONY: goimports | ||
goimports: | ||
@boilerplate/lyft/golang_test_targets/goimports | ||
|
||
.PHONY: install download_tooling mod_download | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
download_tooling: #download dependencies (including test deps) for the package | ||
boilerplate/lyft/golang_test_targets/download_tooling.sh | ||
|
||
mod_download: #download dependencies (including test deps) for the package | ||
go mod download | ||
|
||
.PHONY: install | ||
install: #download dependencies (including test deps) for the package | ||
which dep || (curl "https://raw.githubusercontent.com/golang/dep/${DEP_SHA}/install.sh" | sh) | ||
dep ensure | ||
install: | ||
download_tooling mod_download | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be right after
|
||
|
||
.PHONY: test_unit | ||
test_unit: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Everything in this file needs to be installed outside of current module | ||
# The reason we cannot turn off module entirely and install is that we need the replace statement in go.mod | ||
# because we are installing a mockery fork. Turning it off would result installing the original not the fork. | ||
# However, because the installation of these tools themselves sometimes modifies the go.mod/go.sum files. We don't | ||
# want this either. So instead, we're going to copy those files into a temporary directory, do the installation, and= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
# ignore any changes made to the go mod files. | ||
# (See https://github.com/golang/go/issues/30515 for some background context) | ||
|
||
go_get_mockery () { | ||
tmp_dir=$(mktemp -d -t gotooling-XXXXXXXXXX) | ||
echo tmp_dir | ||
cp go.mod go.sum "$tmp_dir" | ||
pushd "$tmp_dir" | ||
go get github.com/vektra/mockery/cmd/mockery | ||
popd | ||
} | ||
|
||
go_get_pflags () { | ||
tmp_dir=$(mktemp -d -t gotooling-XXXXXXXXXX) | ||
cp go.mod go.sum "$tmp_dir" | ||
pushd "$tmp_dir" | ||
go get github.com/lyft/flytestdlib/cli/pflags | ||
popd | ||
} | ||
|
||
go_get_lint () { | ||
tmp_dir=$(mktemp -d -t gotooling-XXXXXXXXXX) | ||
cp go.mod go.sum "$tmp_dir" | ||
pushd "$tmp_dir" | ||
go get github.com/golangci/golangci-lint/cmd/golangci-lint | ||
popd | ||
} | ||
|
||
go_get_enumer () { | ||
tmp_dir=$(mktemp -d -t gotooling-XXXXXXXXXX) | ||
cp go.mod go.sum "$tmp_dir" | ||
pushd "$tmp_dir" | ||
go get github.com/alvaroloes/enumer | ||
popd | ||
} | ||
|
||
go_get_mockery | ||
go_get_pflags | ||
go_get_lint | ||
go_get_enumer |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ set -e | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | ||
|
||
OUT="$(mktemp -d)" | ||
git clone [email protected]:lyft/boilerplate.git "${OUT}" | ||
git clone --single-branch --branch gomod [email protected]:lyft/boilerplate.git "${OUT}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will revert this before merging, just here for testing. |
||
|
||
echo "Updating the update.sh script." | ||
cp "${OUT}/boilerplate/update.sh" "${DIR}/update.sh" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops it seems I introduced this empty line.