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

Go 1.18.4 and golangci 1.48: "Error: File is not gofmt-ed with -s (gofmt)" #535

Closed
davidwarshaw opened this issue Aug 5, 2022 · 6 comments
Labels
bug Something isn't working upstream related the golangci-lint but not to the action

Comments

@davidwarshaw
Copy link

davidwarshaw commented Aug 5, 2022

Github actions pulling golangci-lint 1.48 result in the error:

run golangci-lint
  Running [/home/runner/golangci-lint-1.48.0-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=mydir] in [/home/runner/work/mydir] ...
  Error: File is not `gofmt`-ed with `-s` (gofmt)
  Error: File is not `gofmt`-ed with `-s` (gofmt)
  Error: File is not `gofmt`-ed with `-s` (gofmt)
  
  Error: issues found
  Ran golangci-lint in 11686ms

With these settings:

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version: "^1.18"
      - uses: golangci/golangci-lint-action@v3
        with:
          working-directory: ${{ matrix.dir }}

Golang setup:

Run actions/setup-go@v3
Setup go version spec ^1.18
Found in cache @ /opt/hostedtoolcache/go/1.1[8](https://github.com/myorg/mydir/runs/7695399646?check_suite_focus=true#step:3:9).4/x64
Added go to the path
Successfully set up Go version ^1.18
go version go1.18.4 linux/amd64

Rolling back to golangci-lint 1.47.3 resolves the issue:

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version: "^1.18"
      - uses: golangci/golangci-lint-action@v3
        with:
          working-directory: ${{ matrix.dir }}
          version: v1.47.3

Resolved:

run golangci-lint
  Running [/home/runner/golangci-lint-1.47.3-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=mydir] in [/home/runner/work/mydir] ...
  golangci-lint found no issues
  Ran golangci-lint in 11821ms
@nishantwrp
Copy link

nishantwrp commented Aug 7, 2022

After some investigation I think that it maybe because this action uses gofmt linter by go 1.19 instead of using the linter by the version of go that is configured in the github workflow.

@sebastian-quintero
Copy link

Yes in this issue that I posted and was closed in favor of the current one, I discovered that by locally upgrading to Go1.19, then I got the errors that the GitHub action was complaining about ➡️ golangci/golangci-lint#3069

@zzjin
Copy link

zzjin commented Aug 9, 2022

I found it may be related to go1.19's go fmt doc update. @see golang/go#54349

skylenet added a commit to skylenet/eth-proxy that referenced this issue Aug 10, 2022
lalexgap added a commit to statechannels/go-nitro that referenced this issue Aug 15, 2022
Support for go1.19 seemed to introduce a formatting
issue: golangci/golangci-lint-action#535
viccuad added a commit to viccuad/kubewarden-controller that referenced this issue Aug 24, 2022
golangci v1.48 uses `go fmt` from go 1.19, but that version of `go fmt`
is incompatible with the one in go 1.17 that we use.

See
golangci/golangci-lint-action#535
jvanz pushed a commit to kubewarden/kubewarden-controller that referenced this issue Aug 24, 2022
golangci v1.48 uses `go fmt` from go 1.19, but that version of `go fmt`
is incompatible with the one in go 1.17 that we use.

See
golangci/golangci-lint-action#535
stephenmcconkey added a commit to harness/ff-golang-server-sdk that referenced this issue Oct 4, 2022
stephenmcconkey added a commit to harness/ff-golang-server-sdk that referenced this issue Oct 5, 2022
…, standardise segment and flags being set (#98)

* Update Go version in SDK
* Add logic to allow user defined cache to be populated
* Add flag for initial load so that oldflag check doesn't occur on first load
* Update to use more recent ff-test-cases submodule
* Pin version of Go lint as per golangci/golangci-lint-action#535
@nishantwrp
Copy link

Hi, I wanted to know if there is an ETA to when this issue will be fixed? Or is this not a priority right now?

@sioncojp
Copy link

I'm facing this issue right now, is there a way around it?

bjwswang pushed a commit to bjwswang/fabric-operator that referenced this issue Feb 1, 2023
Signed-off-by: bjwswang <bjwswang@gmail>

Changelogs
    1. fixed channel creation bug: tlsca not working in fabric-ca
    2. able to join peers into channel
    3. save channel list in network.status.channels
    4. fix orderer override on network creation which should use tlsca in tls
    5. fix peer unit test
    6. fix golangci-lint test: bug from latest version of golangci-lint(golangci/golangci-lint-action#535)
@271285136
Copy link

可以尝试执行 golangci-lint cache clean

@ldez ldez added the upstream related the golangci-lint but not to the action label Jun 19, 2023
davejohnston pushed a commit to davejohnston/ff-golang-server-sdk that referenced this issue Sep 26, 2023
…, standardise segment and flags being set (harness#98)

* Update Go version in SDK
* Add logic to allow user defined cache to be populated
* Add flag for initial load so that oldflag check doesn't occur on first load
* Update to use more recent ff-test-cases submodule
* Pin version of Go lint as per golangci/golangci-lint-action#535
@ldez ldez closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream related the golangci-lint but not to the action
Projects
None yet
Development

No branches or pull requests

7 participants