Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Set GOPROXY to default if it is not configured #103

Conversation

joonas
Copy link
Contributor

@joonas joonas commented Aug 8, 2019

What this PR does / why we need it:

This is necessary since go env GOPROXY will return an empty string if the value is not set, thus setting GOPROXY to an empty string, which doesn't quite do what we want.

Special notes for your reviewer:

I've verified this locally by doing a fresh checkout without GOPROXY being set and running make test, which resulted in:

verifying gomodules.xyz/jsonpatch/[email protected]: checksum mismatch
	downloaded: h1:OyHbl+7IOECpPKfVK42oFr6N7+Y2dR+Jsb/IiDV3hOo=
	go.sum:     h1:lHNQverf0+Gm1TbSbVIDWVXOhZ2FpZopxRqpr2uIjs4=
make: *** [fmt] Error 1

After applying this change and running make test again things worked as expected.

Release note:

NONE

/cc @chuckha @amy

@k8s-ci-robot
Copy link
Contributor

Welcome @joonas!

It looks like this is your first PR to kubernetes-sigs/cluster-api-bootstrap-provider-kubeadm 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-bootstrap-provider-kubeadm has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested review from amy and chuckha August 8, 2019 17:20
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 8, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @joonas. Thanks for your PR.

I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 8, 2019
Copy link
Contributor

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm Indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 8, 2019
@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

/hold
we want to honor go env GOPROXY if we can

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 8, 2019
@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

I have a clean checkout, I don't have GOPROXY set, and make test passes for me...

@joonas
Copy link
Contributor Author

joonas commented Aug 8, 2019

I have a clean checkout, I don't have GOPROXY set, and make test passes for me...

@ncdc Just to check, did you run go clean -modcache before running make test to make sure you have an empty cache?

@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

Doing that now. Will report back

@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

Ok I get the same error with a clean modcache

@joonas
Copy link
Contributor Author

joonas commented Aug 8, 2019

Ok I get the same error with a clean modcache

Sorry I should've mentioned that being a pre-requisite originally on the ticket.

The goal is to honor GOPROXY if it's set, but set a reasonable default in case it's not in order to get around the error with jsonpatch.

@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

How about this?

GOPROXY := $(shell go env GOPROXY)
ifeq ($(GOPROXY),)
GOPROXY := https://proxy.golang.org
endif

@joonas
Copy link
Contributor Author

joonas commented Aug 8, 2019

Happy to change it to that, that's definitely more succinct & idiomatic.

@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

LGTM, please squash & thanks!
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joonas, ncdc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2019
This is necessary since 'go env GOPROXY' will return an empty string if the
value is not set, thus setting GOPROXY to nothing.

Signed-off-by: Joonas Bergius <[email protected]>
@chuckha
Copy link
Contributor

chuckha commented Aug 8, 2019

/lgtm

thanks @joonas

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@chuckha
Copy link
Contributor

chuckha commented Aug 8, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 8, 2019
@joonas joonas force-pushed the set-goproxy-to-default-if-empty branch from 3f35bd2 to 05fb110 Compare August 8, 2019 17:46
@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@ncdc
Copy link
Contributor

ncdc commented Aug 8, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 8, 2019
@k8s-ci-robot k8s-ci-robot merged commit 166cae2 into kubernetes-retired:master Aug 8, 2019
@joonas joonas deleted the set-goproxy-to-default-if-empty branch August 8, 2019 17:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants