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 go format checking on travis #52

Merged
merged 1 commit into from
Apr 21, 2017

Conversation

pravj
Copy link
Contributor

@pravj pravj commented Apr 21, 2017

This pull request add a source code format checking using gofmt.

It customises the build's script section and does a format check before running the test cases.

If the source code is not formatted according to the standard, it will fail the build suggesting the prospective changes.

Go code is not properly formatted. Use 'gofmt'.
diff main.go gofmt/main.go
--- /var/folders/kr/z6l_jmvs0916l5yhzzkgrysm0000gn/T/gofmt153062035	2017-04-21 12:37:03.000000000 +0530
+++ /var/folders/kr/z6l_jmvs0916l5yhzzkgrysm0000gn/T/gofmt346248406	2017-04-21 12:37:03.000000000 +0530
@@ -1,4 +1,4 @@
-package 	main
+package main
 
 import (
 	"flag"

This change is Reviewable

@codecov
Copy link

codecov bot commented Apr 21, 2017

Codecov Report

Merging #52 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   73.59%   73.59%           
=======================================
  Files          66       66           
  Lines        1530     1530           
=======================================
  Hits         1126     1126           
  Misses        378      378           
  Partials       26       26

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bb200e...55c9a9d. Read the comment docs.

@pravj
Copy link
Contributor Author

pravj commented Apr 21, 2017

This will be a fix for #40 (Add "go fmt" to travis).

@elliotchance
Copy link
Owner

Reviewed 2 of 2 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@elliotchance elliotchance merged commit f92a6b3 into elliotchance:master Apr 21, 2017
@elliotchance
Copy link
Owner

Awesome, thanks @pravj !

@pravj pravj deleted the travis-gofmt branch April 21, 2017 07:37
@sbinet
Copy link

sbinet commented Apr 21, 2017

apologies for coming late to the party.

instead of adding this to Travis-CI, I prefer to create a TestGofmt(t *testing.T) test (so people actually running tests will see it before bugging Travis).

see:
go-hep/hep@0b78c29

@elliotchance
Copy link
Owner

@sbinet - I like that ides.

One thing that is bugging me is we are mixing integration and unit tests with go test. I know there is a -run condition, but I can't find an easy way to exclude or run only the tests that don't match a regex?

@sbinet
Copy link

sbinet commented Apr 21, 2017

a "simple" workaround is to prefix all unit tests with Unit and all integration tests with Integ.

ie:
TestUnitFoo(t *testing.T)
TestIntegFoo(t *testing.T)

@zoeyfyi
Copy link
Contributor

zoeyfyi commented Apr 21, 2017

The standard library makes unit tests use short mode, so to run all unit tests use go test -short

@elliotchance elliotchance added this to the v0.8.x milestone Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants