Skip to content

CI should run gofmt/goimports and govet #582

Closed

Description

@grantr

Expected Behavior

Code that has not been properly formatted fails CI and cannot be merged.

Actual Behavior

Code is able to be merged without having the correct golang formatting (see here).

Steps to Reproduce the Problem

  1. Create a PR containing code that hasn't been formatted or vetted.
  2. Observe that no status check fails.

@adrcunha WDYT? This could be a separate check that runs gofmt (or goimports) and govet and fails when they generate changes or warnings.

Activity

  1. added
    area/test-and-release
    on Apr 4, 2018
  2. adrcunha commented on Apr 5, 2018

    @adrcunha
    Contributor

    SGTM. Easy to do, and useful.

  3. adrcunha commented on Apr 5, 2018

    @adrcunha
    Contributor

    Steps:

    1. Create a script to run gofmt (or goimports) and govet (can be a simple branch of hack/coverage.sh)
    2. Create a prow test job to run the script on every pull request.
  4. adrcunha commented on Apr 16, 2018

    @adrcunha
    Contributor

    /lint plugin is currently enabled for prow, but looks like it's not working. I'm investigating.

  5. adrcunha commented on Apr 17, 2018

    @adrcunha
    Contributor

    Cole fixed the issue that was preventing the lint plugin from working:

    kubernetes/test-infra#7719

  6. adrcunha commented on Apr 17, 2018

    @adrcunha
    Contributor

    @cjwagner explained that the golint plugin doesn't run automatically because it is only applicable to some PRs and leaves long reviews. If we ran it everywhere it would quickly be dubbed spam. It is also a pretty expensive operation compared to most plugins. If it was migrated to an external plugin it could be updated to run automatically in certain repos.

    @grantr is /lint good enough for our purposes? I prefer it than a hard-to-read output like what I proposed in my second comment.

  7. grantr commented on Apr 17, 2018

    @grantr
    ContributorAuthor

    /lint is fine. My preference would be to have both: a status check to let reviewers know linters failed (perhaps optional for merging) and /lint to turn the results into easy-to-read comments.

  8. grantr commented on Apr 17, 2018

    @grantr
    ContributorAuthor

    @adrcunha since we have /lint for now, I'll close this and we can open a separate issue if we still want prow to run linters automatically.

  9. self-assigned this
    on Apr 17, 2018
  10. adrcunha commented on Apr 17, 2018

    @adrcunha
    Contributor

    SGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/test-and-release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions