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 pipe ( to catch go vet output ) #9

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: ./testdata/example/go.mod
check-latest: true

- name: Run gostyle
uses: ./
with:
work-dir: ./testdata/example
reviewdog-filter-mode: nofilter
reviewdog-reporter: github-pr-check
fail-on-error: false
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ runs:
id: pipe
if: inputs.use-reviewdog != 'false'
run: |
echo 'PIPE=| reviewdog -name=${{ inputs.reviewdog-tool-name }} -f=golint -filter-mode="${{ inputs.reviewdog-filter-mode }}" --reporter=${{ inputs.reviewdog-reporter }} --tee' >> "$GITHUB_OUTPUT"
echo 'PIPE=|& reviewdog -name=${{ inputs.reviewdog-tool-name }} -f=golint -filter-mode="${{ inputs.reviewdog-filter-mode }}" --reporter=${{ inputs.reviewdog-reporter }} --tee' >> "$GITHUB_OUTPUT"
shell: bash
- name: Set fail-on-error
id: failonerror
Expand Down
1 change: 1 addition & 0 deletions testdata/example/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module "github.com/k1LoW/gostyle-action/testdata/example"
15 changes: 15 additions & 0 deletions testdata/example/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import "fmt"

type Query interface { // want "gostyle.ifacenames"

Check failure on line 5 in testdata/example/main.go

View workflow job for this annotation

GitHub Actions / gostyle

[gostyle] testdata/example/main.go#L5

[gostyle.ifacenames] By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun. (ref: https://go.dev/doc/effective_go#interface-names ): Query
Raw output
./main.go:5:12: [gostyle.ifacenames] By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun. (ref: https://go.dev/doc/effective_go#interface-names ): Query
Do() error
}

type Getter interface {

Check failure on line 9 in testdata/example/main.go

View workflow job for this annotation

GitHub Actions / gostyle

[gostyle] testdata/example/main.go#L9

[gostyle.ifacenames] By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun. (ref: https://go.dev/doc/effective_go#interface-names ): Getter
Raw output
./main.go:9:13: [gostyle.ifacenames] By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun. (ref: https://go.dev/doc/effective_go#interface-names ): Getter
GetSomething() // want "gostyle.getters"

Check failure on line 10 in testdata/example/main.go

View workflow job for this annotation

GitHub Actions / gostyle

[gostyle] testdata/example/main.go#L10

[gostyle.getters] Function and method names should not use a "Get" or "get" prefix, unless the underlying concept uses the word "get" (e.g. an HTTP GET). Prefer starting the name with the noun directly, for example use "Counts" over "GetCounts". (ref: https://google.github.io/styleguide/go/decisions#getters ): GetSomething
Raw output
./main.go:10:2: [gostyle.getters] Function and method names should not use a "Get" or "get" prefix, unless the underlying concept uses the word "get" (e.g. an HTTP GET). Prefer starting the name with the noun directly, for example use "Counts" over "GetCounts". (ref: https://google.github.io/styleguide/go/decisions#getters ): GetSomething
}

func main() {
fmt.Println("hello")
}
Loading