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

Shrink main func to resolve gocyclo warning #207

Merged
merged 1 commit into from
May 17, 2018
Merged

Shrink main func to resolve gocyclo warning #207

merged 1 commit into from
May 17, 2018

Conversation

enocom
Copy link
Contributor

@enocom enocom commented May 16, 2018

Fixes #178

This is the simplest fix to the gocyclo linter error: breaking out functions of related code. I propose taking the same approach for #177.

@enocom enocom requested review from markmandel and EricFortin May 16, 2018 19:05
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 1ba7c0f0-573d-464e-9900-4c25822fd1a9

The following development artifacts have been built, and will exist for the next 30 days:

Copy link
Collaborator

@EricFortin EricFortin left a comment

Choose a reason for hiding this comment

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

LGTM

@enocom
Copy link
Contributor Author

enocom commented May 16, 2018

Rebased onto master for a clean merge.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 8cee3803-148b-4000-89ee-549b6e0e8279

The following development artifacts have been built, and will exist for the next 30 days:

Copy link
Collaborator

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Approved! Just one question for my own curiosity,

@@ -50,7 +49,7 @@ func main() { // nolint: gocyclo
}

log.Print("Starting Health Ping")
stop := make(chan bool)
stop := make(chan struct{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just for my own curiosity - why the change? Because it more closely matches context.Context and some of the Kubernetes constructs?

Copy link
Contributor Author

@enocom enocom May 17, 2018

Choose a reason for hiding this comment

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

Since stop is used purely as a signalling mechanism, and not as a way to transport meaningful information, I have followed the Go idiom of using struct{}, which indicates the value is of no meaning in and of itself. On the other hand, bool suggests we might send true or false, when in fact we don't really care about either.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! That makes perfect sense!

@markmandel markmandel merged commit 0e672ef into googleforgames:master May 17, 2018
@enocom enocom deleted the simple-main branch May 17, 2018 03:30
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 77855fb2-87ff-4b09-873d-05e7247d5690

Build Logs
starting build "77855fb2-87ff-4b09-873d-05e7247d5690"

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/agones-images/r/agones
 * branch            001c4fc0ab4a01ce63bd6e35ffd95c717d5c79c1 -> FETCH_HEAD
HEAD is now at 001c4fc Shrink main func to resolve gocyclo warning
BUILD
Starting Step #0
Step #0: Already have image (with digest): ubuntu
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/docker
Step #1: Sending build context to Docker daemon  131.1MB

Step #1: Step 1/3 : FROM gcr.io/cloud-builders/docker
Step #1:  ---> 9f8e1da170b2
Step #1: Step 2/3 : RUN apt-get install make
Step #1:  ---> Running in 897c89fb7496
Step #1: Reading package lists...
Step #1: Building dependency tree...
Step #1: Reading state information...
Step #1: Suggested packages:
Step #1:   make-doc
Step #1: The following NEW packages will be installed:
Step #1:   make
Step #1: 0 upgraded, 1 newly installed, 0 to remove and 31 not upgraded.
Step #1: Need to get 151 kB of archives.
Step #1: After this operation, 365 kB of additional disk space will be used.
Step #1: Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 make amd64 4.1-6 [151 kB]
Step #1: Fetched 151 kB in 0s (253 kB/s)
Step #1: Selecting previously unselected package make.
Step #1: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 11239 files and directories currently installed.)
Step #1: Preparing to unpack .../archives/make_4.1-6_amd64.deb ...
Step #1: Unpacking make (4.1-6) ...
Step #1: Setting up make (4.1-6) ...
Step #1: Removing intermediate container 897c89fb7496
Step #1:  ---> eba913a38c85
Step #1: Step 3/3 : ENTRYPOINT ["/usr/bin/make"]
Step #1:  ---> Running in 39f8c060b06f
Step #1: Removing intermediate container 39f8c060b06f
Step #1:  ---> 84aa15d841f1
Step #1: Successfully built 84aa15d841f1
Step #1: Successfully tagged make-docker:latest
Finished Step #1
Starting Step #2
Step #2: Already have image: make-docker
Step #2: docker pull gcr.io/agones-images/agones-build:e52ce865fb && docker tag gcr.io/agones-images/agones-build:e52ce865fb agones-build:e52ce865fb
Step #2: e52ce865fb: Pulling from agones-images/agones-build
Step #2: c73ab1c6897b: Pulling fs layer
Step #2: 3091fac74ac3: Pulling fs layer
Step #2: 32ec8f15f1df: Pulling fs layer
Step #2: 8a19269d40b4: Pulling fs layer
Step #2: e6425ad9525a: Pulling fs layer
Step #2: 16df2efc4858: Pulling fs layer
Step #2: 2b2d73ab4219: Pulling fs layer
Step #2: 5f2d382df949: Pulling fs layer
Step #2: 5b739d0afd39: Pulling fs layer
Step #2: eb921739ae12: Pulling fs layer
Step #2: 2022ec0c796a: Pulling fs layer
Step #2: 3ee570d976e5: Pulling fs layer
Step #2: 59f7198d9c1c: Pulling fs layer
Step #2: 08501ff593d9: Pulling fs layer
Step #2: a5d32e6825a2: Pulling fs layer
Step #2: 42602390dd8d: Pulling fs layer
Step #2: 8a19269d40b4: Waiting
Step #2: e6425ad9525a: Waiting
Step #2: 16df2efc4858: Waiting
Step #2: 2b2d73ab4219: Waiting
Step #2: 5f2d382df949: Waiting
Step #2: 5b739d0afd39: Waiting
Step #2: eb921739ae12: Waiting
Step #2: 2022ec0c796a: Waiting
Step #2: 3ee570d976e5: Waiting
Step #2: 59f7198d9c1c: Waiting
Step #2: 08501ff593d9: Waiting
Step #2: a5d32e6825a2: Waiting
Step #2: 42602390dd8d: Waiting
Step #2: c73ab1c6897b: Verifying Checksum
Step #2: c73ab1c6897b: Download complete
Step #2: 8a19269d40b4: Verifying Checksum
Step #2: 8a19269d40b4: Download complete
Step #2: c73ab1c6897b: Pull complete
Step #2: e6425ad9525a: Verifying Checksum
Step #2: e6425ad9525a: Download complete
Step #2: 16df2efc4858: Verifying Checksum
Step #2: 16df2efc4858: Download complete
Step #2: 3091fac74ac3: Verifying Checksum
Step #2: 3091fac74ac3: Download complete
Step #2: 5f2d382df949: Verifying Checksum
Step #2: 5f2d382df949: Download complete
Step #2: 5b739d0afd39: Verifying Checksum
Step #2: 5b739d0afd39: Download complete
Step #2: 2b2d73ab4219: Verifying Checksum
Step #2: 2b2d73ab4219: Download complete
Step #2: eb921739ae12: Verifying Checksum
Step #2: eb921739ae12: Download complete
Step #2: 32ec8f15f1df: Verifying Checksum
Step #2: 32ec8f15f1df: Download complete
Step #2: 3ee570d976e5: Verifying Checksum
Step #2: 3ee570d976e5: Download complete
Step #2: 59f7198d9c1c: Verifying Checksum
Step #2: 59f7198d9c1c: Download complete
Step #2: 08501ff593d9: Verifying Checksum
Step #2: 08501ff593d9: Download complete
Step #2: a5d32e6825a2: Verifying Checksum
Step #2: a5d32e6825a2: Download complete
Step #2: 3091fac74ac3: Pull complete
Step #2: 2022ec0c796a: Verifying Checksum
Step #2: 2022ec0c796a: Download complete
Step #2: 42602390dd8d: Verifying Checksum
Step #2: 42602390dd8d: Download complete
Step #2: 32ec8f15f1df: Pull complete
Step #2: 8a19269d40b4: Pull complete
Step #2: e6425ad9525a: Pull complete
Step #2: 16df2efc4858: Pull complete
Step #2: 2b2d73ab4219: Pull complete
Step #2: 5f2d382df949: Pull complete
Step #2: 5b739d0afd39: Pull complete
Step #2: eb921739ae12: Pull complete
Step #2: 2022ec0c796a: Pull complete
Step #2: 3ee570d976e5: Pull complete
Step #2: 59f7198d9c1c: Pull complete
Step #2: 08501ff593d9: Pull complete
Step #2: a5d32e6825a2: Pull complete
Step #2: 42602390dd8d: Pull complete
Step #2: Digest: sha256:0344289d4121c2024d5b7d8790a8f3a5043b2149c0632928a2d4d9d0b8473f24
Step #2: Status: Downloaded newer image for gcr.io/agones-images/agones-build:e52ce865fb
Finished Step #2
Starting Step #3
Step #3: Already have image: make-docker
Step #3: mkdir -p ~/.kube
Step #3: mkdir -p /workspace/build//.config/gcloud
Step #3: docker run --rm -v /workspace/build//.config/gcloud:/root/.config/gcloud -v ~/.kube:/root/.kube -v /workspace:/go/src/agones.dev/agones -w /go/src/agones.dev/agones  agones-build:e52ce865fb bash -c \
Step #3: 	"/root/gen-lint-exclude.sh && gometalinter --config .exclude.gometalinter.json --deadline 100s -t --skip vendor ./..."
Step #3: WARNING: deadline exceeded by linter megacheck (try increasing --deadline)
Step #3: WARNING: deadline exceeded by linter errcheck (try increasing --deadline)
Step #3: make: *** [lint] Error 2
Step #3: Makefile:136: recipe for target 'lint' failed
Finished Step #3
ERROR
ERROR: build step 3 "make-docker" failed: exit status 2

@markmandel markmandel added this to the 0.2 milestone May 19, 2018
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label May 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix cyclomatic complexity in examples/simple-udp/server/main.go
4 participants