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

Add gofmt script to enforce Go formatting #219

Merged

Conversation

soulclimberchick
Copy link
Contributor


This PR solves issue #164

What does this PR do?
added gofmt -l which checks for go formatting issues and logs them in the directory it was run from.

Any background context you want to provide?
this change is made in .travis.yml file under the before-install: action.
Please give me any and all feedback. This is my first contribution and pull request on an open source project! Thanks! I will be adding an additional pull request for some documentation change requests!

@soulclimberchick
Copy link
Contributor Author

soulclimberchick commented Aug 16, 2020

forgot to add - passed tests in Travis CI, but there were a couple of unrelated errors in the test:

389Speaking ->  here are the top search results
3902020/08/16 04:19:50 04:19:50.599 Error ▶ ERRO 001 exec: "mplayer": executable file not found in $PATH
391--- FAIL: TestGoogleSearch (6.02s)
392panic: Post http://localhost:3000/message: EOF [recovered]
393	panic: Post http://localhost:3000/message: EOF

and 

``` testing.tRunner(0xc000116100, 0x6f30a8)
403	/home/travis/.gimme/versions/go1.11.13.linux.amd64/src/testing/testing.go:827 +0xbf
404created by testing.(*T).Run
405	/home/travis/.gimme/versions/go1.11.13.linux.amd64/src/testing/testing.go:878 +0x35c
406FAIL	command-line-arguments	6.022s
407The command "go test service/controllers/controllers_test.go" exited with 1. 

Ending with 
``` The command "xvfb-run -s "-screen 0 1920x1080x16" -a mocha test.js" exited with 1.

@soulclimberchick soulclimberchick changed the title added gofmt -l to travis ci WIP: added gofmt -l to travis ci Aug 16, 2020
@soulclimberchick
Copy link
Contributor Author

Realized this doesn't give an exit code. Looking for a better solution.

Add a script run at build time that checks Go formatting and fails if it
needs formatting.
@soulclimberchick soulclimberchick changed the title WIP: added gofmt -l to travis ci Add gofmt script to enforce Go formatting Aug 20, 2020
@soulclimberchick
Copy link
Contributor Author

Added a script that runs at build and fails the build if it detects any formatting errors.

Note there were two errors when running Travis CI relating to an executable file and selenium unrelated to this issue.

The script runs successfully and tests showed it failing when formatting errors were found and passing when formatting errors were cleaned up.

@Harkishen-Singh
Copy link
Owner

Harkishen-Singh commented Aug 20, 2020

Thank you @soulclimberchick for this PR and showing your interest in contributions.

This PR looks good, so I will merge this with the upstream (thought tests fail). However, I do want to make you aware that this project is being ported to NodeJS due to lack of some specific libraries (and also fewer contributors from the community), a reason why the go-code & tests lacked support at present.

The node-master branch is the new master branch that will be merged with the master, in the future.

So, if you want to contribute specific to go-code, I will advise you to choose our more active project that is in use and active development in Go. You can take a look at bench-routes which is purely in Go. It is in very active development and release process and we would love to get active contributions in it. If you find that project interesting, all related documents should be easily available in the repository. Feel free to ask for any help or queries.

Here is the gitter channel of bench-routes in case you require any help: https://gitter.im/bench-routes/community

@Harkishen-Singh Harkishen-Singh merged commit 03cd6b4 into Harkishen-Singh:master Aug 20, 2020
@soulclimberchick
Copy link
Contributor Author

Thank you so much for my first opportunity to contribute to an open source project. And thank you for taking the time to let me know about the transition and the other opportunity on bench-routes! I will definitely hop over there and see what I can contribute! Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants