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

Fix gometalinter flakes by setting CGO_ENABLED=0 #18

Merged
merged 1 commit into from
Jul 9, 2018

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Jul 9, 2018

I looked into the lint CI failures in #17 by re-running the job with ssh enabled. In the shell I ran

gometalinter --debug --vendor ./...

In the debug output I noticed

/go/bin/structcheck returned exit status 1: exec: "gcc": executable file not found in $PATH

Often (maybe always) when you get linter errors reported for /usr/local/go this indicates that linting is failing because go build failed.

The gometalinter docker image uses alpine and doesn't include gcc and all the c header files, so running with CGO_ENABLED=0 fixes the build by using the pure-go compiler.

Also added a config file to explicitly define and configure linters. I added a few additional linters that aren't in the default set but which I find helpful (gosimple, misspell, goimports, nakedret, unparam).

I also removed dupl from the list, which is enabled by default. In my experience the warnings this reports are often not very valuable, but I would be happy to re-enabled it if you would like.

Also add a config file to explicitly define linters
"Concurrency": 2,
"Linters": {
"gofmt": {"Command": "gofmt -l -s -w"},
"goimports": {"Command": "goimports -l -w"}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just for convenience. It adds the -w flags for these two commands so that if you run it locally, and there are errors, the fixes for the errors will be written.

Copy link
Contributor

@hannahhenderson hannahhenderson left a comment

Choose a reason for hiding this comment

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

lgtm, though my Go-knowledge is limited

@marcomorain
Copy link
Contributor

Awesome, thanks @dnephin

@marcomorain marcomorain merged commit b4f9d52 into master Jul 9, 2018
@marcomorain marcomorain deleted the dnephin/fix-gometalinter-in-ci branch July 9, 2018 21:05
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.

3 participants