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

How can i get more detail infos in the golang-lint-action #618

Closed
3 tasks done
jnan806 opened this issue Dec 6, 2022 · 9 comments
Closed
3 tasks done

How can i get more detail infos in the golang-lint-action #618

jnan806 opened this issue Dec 6, 2022 · 9 comments
Labels
question Further information is requested

Comments

@jnan806
Copy link

jnan806 commented Dec 6, 2022

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

the logs is too few, and i cannot judge what the problem in the logs.

How can i get more detail infos in the golang-lint-action

image

In local, if i exec the command directly , it will print the detail infos, like following:
image

Version of golangci-lint

latest

Version of the GitHub Action

golangci/golangci-lint-action@v3

Workflow file

jobs:

  lint:
    name: Lint check
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: 1.18

    - name: Check out code into the Go module directory
      uses: actions/checkout@v3

    - name: Golangci Lint
      # https://golangci-lint.run/
      uses: golangci/golangci-lint-action@v3
      with:
        version: latest

Go version

1.18

Code example or link to a public repository

https://github.com/opensergo/opensergo-go-sdk/actions/runs/3627078730/jobs/6116638569

.golangci.yml

# Options for analysis running.
run:
  # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs-use-default: true
  skip-dirs:
    - pkg/proto
    - samples
    - pkg/common/logging/samples
  skip-files:
    - ".*\\.pb\\.go$"
# output configuration options
output:
  format: colored-line-number
# Refer to https://golangci-lint.run/usage/linters
linters-settings:
  govet:
    # Disable analyzers by name.
    # Run `go tool vet help` to see all analyzers.
    disable:
      - stdmethods
linters:
  disable-all: true
  enable:
    - goimports
    - gofmt
    - misspell
    - govet
    - ineffassign
    - staticcheck
issues:
  exclude-use-default: true
@dewey
Copy link

dewey commented Dec 22, 2022

Just came here to see if I'm doing something wrong. I'm facing the same issue.

Coming from GitLab CI where the error, line number and file name is easily available to paste it into my IDE (bringing me to the exact spot the issue is happening) this absence is very confusing.

@jnan806
Copy link
Author

jnan806 commented Dec 26, 2022

@dewey

maybe #119 (comment) is useful for you to resolve it, but it is not be the best way

@ldez ldez added the question Further information is requested label Jan 16, 2023
@jnan806
Copy link
Author

jnan806 commented Jan 18, 2023

@ldez I resolved this issue by #119 (comment), but I think it is not the best way. Because there is a param in .golangci.yaml like following:
image
So does golangci-lint-action can exec with above param?

@ldez
Copy link
Member

ldez commented Jun 12, 2023

With the new version of the action (v3.6.0) you can now provide extra args to add extra output format.

Example:

    - name: Golangci Lint
      uses: golangci/golangci-lint-action@v3
      with:
        version: v1.53.2
        args: --out-format=colored-line-number

https://golangci-lint.run/usage/configuration/#output-configuration

Related to #769

@ldez ldez closed this as completed Jun 12, 2023
@jnan806
Copy link
Author

jnan806 commented Jun 14, 2023

With the new version of the action (v3.6.0) you can now provide extra args to add extra output format.

Example:

    - name: Golangci Lint
      uses: golangci/golangci-lint-action@v3
      with:
        version: v1.53.2
        args: --out-format=colored-line-number

@ldez
It's ok by adding args in action now ,
but still does not work by define it in .golangci.yaml like following:

@ldez
Copy link
Member

ldez commented Jun 14, 2023

It must be defined through CLI flags like in my example.

@jnan806
Copy link
Author

jnan806 commented Jun 14, 2023

It must be defined through CLI flags like in my example.

yeah, your example is ok .

And in https://golangci-lint.run/usage/configuration/#output-configuration also has a setting item to config the output format, so i think should it also can read from the .golangci.yml? 😄

@ldez
Copy link
Member

ldez commented Jun 14, 2023

And in https://golangci-lint.run/usage/configuration/#output-configuration also has a setting item to config the output format, so I think should it also can read from the .golangci.yml?

The action doesn't read the configuration file because the expected outputs on a CI are different than the local outputs.

So you need to use CLI flags.

@jnan806
Copy link
Author

jnan806 commented Jun 14, 2023

And in https://golangci-lint.run/usage/configuration/#output-configuration also has a setting item to config the output format, so I think should it also can read from the .golangci.yml?

The action doesn't read the configuration file because the expected outputs on a CI are different than the local outputs.

So you need to use CLI flags.

ok , got it ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants