Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

migrate to go module #27

Merged
merged 37 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cf7d31c
migrate to go module
honnix Nov 29, 2019
11c3f51
install mockery
honnix Nov 29, 2019
0daeb85
do not always download pflags
honnix Dec 4, 2019
860f3ef
latest version of flytestdlib
honnix Dec 9, 2019
8bf202c
refomat
honnix Dec 9, 2019
ec65ebc
Revert "refomat"
honnix Dec 9, 2019
e631b11
mockery
honnix Dec 9, 2019
a7848d1
mockery
honnix Dec 9, 2019
cc92288
sum
honnix Dec 9, 2019
e78df69
test
honnix Dec 9, 2019
47b7e4d
test
honnix Dec 9, 2019
7c18213
test
honnix Dec 9, 2019
9517447
test
honnix Dec 9, 2019
141089d
test
honnix Dec 9, 2019
8aa3c9f
Update .travis.yml
honnix Dec 9, 2019
f853bf9
Update Makefile
honnix Dec 9, 2019
6710f8e
Update Makefile
honnix Dec 9, 2019
96361b3
move it to the right place
honnix Dec 9, 2019
01440bb
install mockery in a temp folder
honnix Dec 17, 2019
97593d2
add comments
honnix Dec 17, 2019
32ed155
upgrade flytestdlib
honnix Dec 17, 2019
c264fca
go mod tidy
honnix Dec 17, 2019
38a83f2
add h1 sum
honnix Dec 17, 2019
53ecbe2
test
honnix Jan 3, 2020
57503a9
rebase from master
honnix Jan 3, 2020
9b979a9
latest flytestdlib
honnix Jan 3, 2020
1ac0800
install pflags in tmp folder
honnix Jan 3, 2020
e9331dc
change go version back
honnix Jan 3, 2020
f03bac7
add comment
honnix Jan 3, 2020
8c6bc7a
incorporate latest boilerplate changes
honnix Jan 21, 2020
078fdca
Merge branch 'go-module-migration' of github.com:honnix/flyteidl into…
honnix Jan 21, 2020
6e00aab
rely on Makefile to install mockery
honnix Jan 21, 2020
c4e614b
updated boilerplate
Jan 23, 2020
e58da4f
use install instead
Jan 23, 2020
097ffb6
actually adding the new boilerplate entry and updating again
Jan 24, 2020
25d072a
removing unnecessary files
Jan 24, 2020
6db7756
no need for replacement in root go.mod
honnix Jan 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
664 changes: 0 additions & 664 deletions Gopkg.lock

This file was deleted.

77 changes: 0 additions & 77 deletions Gopkg.toml

This file was deleted.

13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
export GO111MODULE=off
export REPOSITORY=flyteidl
include boilerplate/lyft/golang_test_targets/Makefile

Expand All @@ -8,26 +7,22 @@ update_boilerplate:
@boilerplate/update.sh

.PHONY: generate
generate: # generate protos, mocks and pflags
dep ensure -vendor-only
generate: install # install tools, generate protos, mocks and pflags
./generate_protos.sh
./generate_mocks.sh
go generate ./...

.PHONY: test
test: # ensures generate_protos script has been run
make install
test: install # ensures generate_protos script has been run
git diff
go get github.com/lyft/flytestdlib/cli/pflags
dep ensure -vendor-only
./generate_mocks.sh
go generate ./...
DELTA_CHECK=true ./generate_protos.sh

.PHONY: test_unit
test_unit:
# we cannot use test_unit from go.mk because generated files contain commented import statements that
# go tries to intepret. So we need to use go list to get the packages that go understands.
# we cannot use test_unit from go.mk because generated files contain commented import statements that
# go tries to intepret. So we need to use go list to get the packages that go understands.
go test -cover `go list ./...` -race

.PHONY: build_python
Expand Down
12 changes: 12 additions & 0 deletions boilerplate/lyft/golang_support_tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/lyft/boilerplate

go 1.13

require (
github.com/golangci/golangci-lint v1.22.2
github.com/lyft/flytestdlib v0.2.31
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
github.com/alvaroloes/enumer v1.1.2
)

replace github.com/vektra/mockery => github.com/enghabu/mockery v0.0.0-20191009061720-9d0c8670c2f0
553 changes: 553 additions & 0 deletions boilerplate/lyft/golang_support_tools/go.sum

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions boilerplate/lyft/golang_support_tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build tools

package tools

import (
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/lyft/flytestdlib/cli/pflags"
_ "github.com/vektra/mockery/cmd/mockery"
_ "github.com/alvaroloes/enumer"
)
24 changes: 16 additions & 8 deletions boilerplate/lyft/golang_test_targets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

DEP_SHA=1f7c19e5f52f49ffb9f956f64c010be14683468b

.PHONY: download_tooling
download_tooling: #download dependencies (including test deps) for the package
@boilerplate/lyft/golang_test_targets/download_tooling.sh

.PHONY: lint
lint: #lints the package for common code smells
which golangci-lint || GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
golangci-lint run --exclude deprecated
lint: download_tooling #lints the package for common code smells
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: mod_download
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

.PHONY: show
show: go list -m all

.PHONY: test_unit
test_unit:
Expand All @@ -35,4 +42,5 @@ test_unit_cover:

.PHONY: test_unit_visual
test_unit_visual:
go test ./... -coverprofile /tmp/cover.out -covermode=count; go tool cover -html=/tmp/cover.out
go test ./... -coverprofile /tmp/cover.out -covermode=count; go tool cover -html=/tmp/cover.out

4 changes: 2 additions & 2 deletions boilerplate/lyft/golang_test_targets/Readme.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Golang Test Targets
~~~~~~~~~~~~~~~~~~~

Provides an ``install`` make target that uses ``dep`` install golang dependencies.
Provides an ``install`` make target that uses ``go mod`` to install golang dependencies.

Provides a ``lint`` make target that uses golangci to lint your code.

Expand All @@ -17,7 +17,7 @@ Provides a ``test_benchmark`` target for benchmark tests.

Add ``lyft/golang_test_targets`` to your ``boilerplate/update.cfg`` file.

Make sure you're using ``dep`` for dependency management.
Make sure you're using ``go mod`` for dependency management.

Provide a ``.golangci`` configuration (the lint target requires it).

Expand Down
36 changes: 36 additions & 0 deletions boilerplate/lyft/golang_test_targets/download_tooling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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.
# We also want to version all the other tools. We also want to be able to run go mod tidy without removing the version
# pins. To facilitate this, we're maintaining two sets of go.mod/sum files - the second one only for tooling. This is
# the same approach that go 1.14 will take as well.
# See:
# https://github.com/lyft/flyte/issues/129
# https://github.com/golang/go/issues/30515 for some background context
# https://github.com/go-modules-by-example/index/blob/5ec250b4b78114a55001bd7c9cb88f6e07270ea5/010_tools/README.md

set -e

# List of tools to go get
# In the format of "<cli>:<package>" or ":<package>" if no cli
tools=(
"github.com/vektra/mockery/cmd/mockery"
"github.com/lyft/flytestdlib/cli/pflags"
"github.com/golangci/golangci-lint/cmd/golangci-lint"
"github.com/alvaroloes/enumer"
)

tmp_dir=$(mktemp -d -t gotooling-XXX)
echo "Using temp directory ${tmp_dir}"
cp -R boilerplate/lyft/golang_support_tools/* $tmp_dir
pushd "$tmp_dir"

for tool in "${tools[@]}"
do
echo "Installing ${tool}"
GO111MODULE=on go install $tool
done

popd
1 change: 1 addition & 0 deletions boilerplate/update.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lyft/golang_test_targets
lyft/golangci_file
lyft/golang_support_tools
1 change: 1 addition & 0 deletions boilerplate/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if [ -z "$REPOSITORY" ]; then
fi

while read directory; do
# TODO: Skip empty lines, whitespace only lines, and comment lines
echo "***********************************************************************************"
echo "$directory is configured in update.cfg."
echo "-----------------------------------------------------------------------------------"
Expand Down
1 change: 0 additions & 1 deletion generate_mocks.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
set -e
set -x
which mockery || (go install github.com/lyft/flyteidl/vendor/github.com/vektra/mockery/cmd/mockery)

mockery -dir=gen/pb-go/flyteidl/service/ -name=AdminServiceClient -output=clients/go/admin/mocks
mockery -dir=gen/pb-go/flyteidl/datacatalog/ -name=ArtifactsClient -output=clients/go/datacatalog/mocks
29 changes: 29 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/lyft/flyteidl

go 1.13

require (
github.com/antihax/optional v1.0.0
github.com/coreos/go-oidc v2.1.0+incompatible
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.11.3
github.com/influxdata/influxdb v1.7.9
github.com/lyft/flytestdlib v0.2.31
github.com/mitchellh/mapstructure v1.1.2
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0
golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sys v0.0.0-20191028164358-195ce5e7f934 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6
google.golang.org/grpc v1.24.0
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/square/go-jose.v2 v2.4.1 // indirect
k8s.io/api v0.0.0-20191025225708-5524a3672fbb
k8s.io/client-go v0.0.0-20191016111102-bec269661e48 // indirect
)
Loading