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

cmd/go: gofmt should ignore vendor #33962

Closed
abhigenie92 opened this issue Aug 30, 2019 · 4 comments
Closed

cmd/go: gofmt should ignore vendor #33962

abhigenie92 opened this issue Aug 30, 2019 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@abhigenie92
Copy link

abhigenie92 commented Aug 30, 2019

When you run go fmt $$(go list ./...) it ignores vendor by default but gofmt . doesn't do that.
The use case is if you run fmt without the code modification in-place and ignore the vendor.

One way is gofmt -l (find . -type f -name '*.go'| grep -v "/vendor/"), is there an easier way?

@katiehockman katiehockman changed the title Make gofmt ignore vendor? cmd/go: gofmt should ignore vendor Sep 3, 2019
@katiehockman katiehockman added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 3, 2019
@katiehockman
Copy link
Contributor

/cc @bcmills @jayconrod

@bcmills
Copy link
Contributor

bcmills commented Sep 3, 2019

@abhigenie92, please fill out the full issue template — specifically, it would be helpful to know the exact commands you ran that led to confusion, and to clarify what you observed vs. what you expected.

Specifically:

  • What concrete problem were you trying to solve that led you to run gofmt .?
  • Did you actively cd into the vendor directory before running the command?
  • Are you talking about the behavior of go fmt ., or gofmt .? (That is, is this the problem found in cmd/go, cmd/gofmt, or both?) How did you choose between them?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 3, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 3, 2019

See also #29751.

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

atc0005 added a commit to atc0005/check-mail that referenced this issue Apr 27, 2020
- Vendor dependencies

- Update Makefile and helper shell scripts
  - include `-mod=vendor` build flag for applicable `go`
    commands to reflect Go 1.13 vendoring
    - this includes specifying `-mod=vendor` even for
        `go list` commands, which unless specified results
        in dependencies being downloaded, even when they're
        already provided in a local, top-level `vendor`
        directory
  - update `gofmt` linting call to use a workaround that
    explictly excludes the `/vendor/` path
    golang/go#33962 (comment)

- Update GitHub Actions Workflows
    - Disable running `go get` after checking out code
    - Exclude `vendor` folder from ...
      - Markdown linting checks
      - tests
      - basic build

refs #24
atc0005 added a commit to atc0005/check-mail that referenced this issue Apr 27, 2020
- Vendor dependencies

- Update Makefile and helper shell scripts
  - include `-mod=vendor` build flag for applicable `go`
    commands to reflect Go 1.13 vendoring
    - this includes specifying `-mod=vendor` even for
        `go list` commands, which unless specified results
        in dependencies being downloaded, even when they're
        already provided in a local, top-level `vendor`
        directory
  - update `gofmt` linting call to use a workaround that
    explictly excludes the `/vendor/` path
    golang/go#33962 (comment)

- Update GitHub Actions Workflows
    - Disable running `go get` after checking out code
    - Exclude `vendor` folder from ...
      - Markdown linting checks
      - tests
      - basic build

refs #24
@golang golang locked and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants