Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Gomod Updates #4

Merged
merged 20 commits into from
Jan 23, 2020
Merged

Gomod Updates #4

merged 20 commits into from
Jan 23, 2020

Conversation

wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented Dec 19, 2019

@@ -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}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will revert this before merging, just here for testing.


.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
Copy link
Member

Choose a reason for hiding this comment

The 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 lint depend on download_tooling and push down which check to https://github.com/lyft/boilerplate/pull/4/files#diff-3ec8ae048736f7fca33bd837e03342cbR31

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint: download_tooling


# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install is declared as phony at https://github.com/lyft/boilerplate/pull/4/files#diff-aff368f43e9bd90b088a8b4e6c01bf8fR25 already. Maybe remove that line? Is the convention here to have phony defined separately for each goal?

which dep || (curl "https://raw.githubusercontent.com/golang/dep/${DEP_SHA}/install.sh" | sh)
dep ensure
install:
download_tooling mod_download
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be right after :.

install: download_tooling mod_download

# 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=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo and=


for tool in "${tools[@]}"
do
go_install_tool $tool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do a which ... || ... here?

@honnix
Copy link
Member

honnix commented Jan 8, 2020

Tried addressing comments in #5

@honnix honnix mentioned this pull request Jan 8, 2020
# List of tools to go get
# In the format of "<cli>:<package>" or ":<package>" if no cli
tools=(
"mockery:github.com/vektra/mockery/cmd/mockery"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@honnix let me take one more look tomorrow before merging this PR. I want to add version numbers in here as well.

# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

DEP_SHA=1f7c19e5f52f49ffb9f956f64c010be14683468b

Copy link
Member

@honnix honnix Jan 21, 2020

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.

cli=$(echo "$tool" | cut -d':' -f1)
package=$(echo "$tool" | cut -d':' -f2)
echo "Installing ${package}"
GO111MODULE=on go install "$package"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we install it anyway without checking existence? If that is the case we don't need that column hack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, cuz we want to make sure the version is the right one

Copy link
Member

@honnix honnix Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh I see that point totally. We can remove that column cut thing so the code became much simpler. Also I would suggest we enable shellcheck on TravisCI. NVM there is no CI on this repo.

@honnix
Copy link
Member

honnix commented Jan 23, 2020

Minor comment otherwise LGTM. 👍

EngHabu
EngHabu previously approved these changes Jan 23, 2020
Copy link
Contributor

@EngHabu EngHabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! hopefully the last time we have to visit this...
well until go fundamentally fixes the issue..

"mockery:github.com/vektra/mockery/cmd/mockery"
"pflags:github.com/lyft/flytestdlib/cli/pflags"
"golangci-lint:github.com/golangci/golangci-lint/cmd/golangci-lint"
"enumer:github.com/alvaroloes/enumer"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this pleaaase

@wild-endeavor wild-endeavor merged commit e805c93 into master Jan 23, 2020
@honnix
Copy link
Member

honnix commented Jan 23, 2020

👏

wild-endeavor pushed a commit to flyteorg/flytestdlib that referenced this pull request Jan 24, 2020
pingsutw pushed a commit to pingsutw/flyte-monorepo that referenced this pull request Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants