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

hack/go-fmt: Make it easy to auto-format Go #173

Merged
merged 1 commit into from
Aug 25, 2018

Conversation

wking
Copy link
Member

@wking wking commented Aug 24, 2018

So users and CI tooling can keep our Go clean :).

The find call avoids formatting .build/* (Bazel output) and vendor/* (controlled upstream), because gofmt has no special vendor/ handling built in.

Formatting our Go and then using git diff to show the changes (and error if there were any) makes it easy for:

  • CI to see if there were issues (because of the exit code).
  • Users to see the required changes in the CI logs (because of the output diff).

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 24, 2018
wking added a commit to wking/openshift-release that referenced this pull request Aug 24, 2018
We've had some gofmt issues sneak in recently [1].  We want to catch
that sort of thing in CI, instead of finding out about it later.  This
commit uses the script from openshift/installer@94a2a8ca (hack/go-fmt:
Make it easy to auto-format Go, 2018-08-24, openshift/installer#173)
to automate that check.

[1]: openshift/installer@8f415b9#commitcomment-30284820
@wking
Copy link
Member Author

wking commented Aug 24, 2018

e2e-aws has exhausted its resources:


6 error(s) occurred:

* module.vpc.aws_eip.nat_eip[1]: 1 error(s) occurred:

* aws_eip.nat_eip.1: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: 85a06031-0b41-4709-9cfe-14e46e50afc9
* module.vpc.aws_eip.nat_eip[2]: 1 error(s) occurred:

* aws_eip.nat_eip.2: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: 85c4dfdc-69da-4b26-9692-9f98e235fce6
* module.vpc.aws_eip.nat_eip[0]: 1 error(s) occurred:

* aws_eip.nat_eip.0: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: bfbbc1f2-7f4c-4990-b7dd-ee7519f0c5b1
* module.vpc.aws_eip.nat_eip[3]: 1 error(s) occurred:

* aws_eip.nat_eip.3: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: d28152ab-2091-413e-9015-525e0778710d
* module.vpc.aws_eip.nat_eip[5]: 1 error(s) occurred:

* aws_eip.nat_eip.5: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: 19736627-b525-487c-8186-72de417523a9
* module.vpc.aws_eip.nat_eip[4]: 1 error(s) occurred:

* aws_eip.nat_eip.4: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached.
	status code: 400, request id: 56a8451f-0298-4ac8-8045-18f7b67cea76

So users and CI tooling can keep our Go clean :).

The find call avoids formatting .build/* (Bazel output) and vendor/*
(controlled upstream), because gofmt has no special vendor/ handling
built in [1].

Formatting our Go and then using 'git diff' to show the changes (and
error if there were any) makes it easy for:

* CI to see if there were issues (because of the exit code).
* Users to see the required changes in the CI logs (because of the
  output diff).

[1]: golang/go#22173 (comment)
@yifan-gu
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 24, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wking, yifan-gu

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

@wking
Copy link
Member Author

wking commented Aug 24, 2018

This died with:

Waiting for router to be created ...
NAME                          STATUS    ROLES       AGE       VERSION
ip-10-0-10-151.ec2.internal   Ready     master      2m        v1.11.0+d4cacc0
ip-10-0-7-197.ec2.internal    Ready     bootstrap   2m        v1.11.0+d4cacc0
NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
router    1         0         0            0           12s
Unable to connect to the server: EOF
Installation failed

We've seen that before (e.g. here). But I'll wait until later to kick this off again, because we've had a few e2e-aws resource-exhaustion issues recently.

@eparis
Copy link
Member

eparis commented Aug 25, 2018

/retest

@openshift-merge-robot openshift-merge-robot merged commit bfa7c5a into openshift:master Aug 25, 2018
@wking wking deleted the hack-go-fmt branch August 27, 2018 17:59
wking added a commit to wking/openshift-installer that referenced this pull request Aug 27, 2018
* Drop the go-lint comment from go-fmt.sh.  I'd accidentally
  copy/pasted this over in 87b3e17 (hack/go-fmt: Make it easy to
  auto-format Go, 2018-08-24, openshift#173).
* Suggest users run go-lint over pkg/... as well.

* Simplify the 'go vet' invocation.  The code I'm removing is from
  eb71c8d (Added go-vet shell script, 2018-08-06, openshift#110).  The Travis
  config it replaced was removed in 1765e93 (.travis.yml: Prune
  moved-to-Prow tf-lint, etc., 2018-08-14, openshift#123), but was just
  running:

    go vet ./installer/...

  inside the container.  So I don't think we need the directory
  changing or moving here.  And we should certainly be able to cover
  the test from a single container, instead of launch a new container
  for each requested directory (at least as long as the requested
  directories are under $PWD, and the old script required that
  anyway).
wking added a commit to wking/openshift-installer that referenced this pull request Aug 27, 2018
Catching up with 4e92db8 (Merge pull request openshift#120 from
staebler/asset_graph_engine, 2018-08-24).

* Drop the go-lint comment from go-fmt.sh.  I'd accidentally
  copy/pasted this over in 87b3e17 (hack/go-fmt: Make it easy to
  auto-format Go, 2018-08-24, openshift#173).
* Suggest users run go-lint over pkg/... as well.

* Simplify the 'go vet' invocation.  The code I'm removing is from
  eb71c8d (Added go-vet shell script, 2018-08-06, openshift#110).  The Travis
  config it replaced was removed in 1765e93 (.travis.yml: Prune
  moved-to-Prow tf-lint, etc., 2018-08-14, openshift#123), but was just
  running:

    go vet ./installer/...

  inside the container.  So I don't think we need the directory
  changing or moving here.  And we should certainly be able to cover
  the test from a single container, instead of launch a new container
  for each requested directory (at least as long as the requested
  directories are under $PWD, and the old script required that
  anyway).
EmilienM pushed a commit to shiftstack/installer that referenced this pull request Dec 8, 2020
This commit adds the ability to pass custom userData/startupScripts to
the machines using kubernetes secrets. The previous workflow that used
the machine-setup ConfigMap has been removed in favor of the new one.

Fixes openshift#158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants