Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean the GO mod files by removing the unnecessary indirect imports #1454

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
export GOPROXY?=https://proxy.golang.org/
CONTROLLER_GEN_BIN_PATH := $(shell which controller-gen)

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif

##@ General

# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
Expand All @@ -45,7 +52,9 @@ install: ## Build and install the binary with the current source code. Use it to

.PHONY: generate
generate: ## Update/generate all mock data. You should run this commands to update the mock data after your changes.
make generate-setup
# If exists, rremove the controller-gen installed locally. It ensures that the version which will be used
# is the version defined in the Makefile scaffolded.
- rm -rf $(CONTROLLER_GEN_BIN_PATH)
make generate-testdata
go mod tidy

Expand All @@ -57,11 +66,6 @@ generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/ku
generate-vendor: ## (Deprecated) Update/generate the vendor by using the path $GOPATH/src/sigs.k8s.io/kubebuilder-test
GO111MODULE=off ./generate_vendor.sh

.PHONY: generate-setup
generate-setup: ## Current workarround to generate the testdata with the correct controller-gen version
- rm -rf $(CONTROLLER_GEN_BIN_PATH)
- GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5
Comment on lines -60 to -63
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to remove this section. I imagine that what you can do here is

  1. create a temp directory (e.g. using https://golang.org/pkg/io/ioutil/#TempDir)
  2. cd to that directory
  3. run go get with go modules on
  4. cd to the previous working directory
  5. remove the temp dir.

Copy link
Member Author

@camilamacedo86 camilamacedo86 Apr 11, 2020

Choose a reason for hiding this comment

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

This makefile target was added just to ensure that the correct version will be used.
Note that we just need to remove any pre-existent installation to ensure that. And then, the defined version in the makefile which will be scaffolded will be installed and used. So, it is not required at all and because of this, I keep just the rm -rf line and did not the tmp dir. See: https://github.com/kubernetes-sigs/kubebuilder/pull/1454/files#diff-b67911656ef5d18c4ae36cb6741b7965R57 Is it make sense?


.PHONY: lint
lint: ## Run code lint checks
./scripts/verify.sh
Expand Down
18 changes: 4 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@ module sigs.k8s.io/kubebuilder
go 1.13

require (
github.com/gobuffalo/flect v0.2.0
github.com/golang/protobuf v1.3.4 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/gobuffalo/flect v0.2.1
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v0.0.7
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/mod v0.2.0 // indirect
golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect
golang.org/x/sys v0.0.0-20200302083256-062a44052db1 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20200301222351-066e0c02454c
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
sigs.k8s.io/yaml v1.1.0
golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b
sigs.k8s.io/yaml v1.2.0
)
Loading