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

all: Update workflow actions; set v1.55.2 as lint version #10

Merged
merged 1 commit into from
Jan 5, 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
11 changes: 6 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Run linters

on: [push]
on: [push, pull_request]

jobs:
revive-lint:
name: Revive
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Run Revive
uses: docker://morphy/revive-action:v1
uses: docker://morphy/revive-action:v2
with:
config: .revive.toml
env:
Expand All @@ -22,10 +22,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Run GolangCI-Lint
uses: docker://matousdz/golangci-lint-action:v1.0.0
uses: golangci/golangci-lint-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: .golangci.yml
version: v1.55.2
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Run tests

on: [push]
on: [push, pull_request]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Run tests
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: '1.13'
go-version: '1.18'

- run: go test ./...
- run: go test -race -shuffle=on ./...
30 changes: 17 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
# we are using "github.com/json-iterator/go" instead of json encoder from stdlib
- "encoding/json"
dupl:
threshold: 100
gocritic:
Expand Down Expand Up @@ -38,27 +32,37 @@ linters-settings:
linters:
enable-all: true
disable:
- depguard
# prealloc is not recommended by `golangci-lint` developers.
- prealloc
- gochecknoglobals

# deprecated
- maligned
- exhaustivestruct
- nosnakecase
- scopelint
- structcheck
- ifshort
- varcheck
- deadcode
- golint
- interfacer

issues:
exclude-rules:
- path: _test\.go
linters:
- exhaustruct
- goconst
- dupl

- path: fixtures
linters:
- gocritic
- varcheck
- deadcode
- unused

run:
modules-download-mode: readonly

skip-dirs:
- "fixtures"

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
Expand Down
1 change: 1 addition & 0 deletions .revive.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ignoreGeneratedHeader = false
severity = "warning"
exclude = ["./fixtures/..."]

# confidence <= 0.2 generate a lot of errors from package-comments rule. It marks files that do not contain
# package-level comments as a warning irrespective of existing package-level coment in one file.
Expand Down
3 changes: 1 addition & 2 deletions fixtures/01/example1.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package main

import "fmt"

// This comment is associated with the hello constant.x
//
//revive:disable
// This comment is associated with the hello constant.x
const hello = "Hello, World!" // line comment 1

// This comment is associated with the foo variable.
Expand Down
2 changes: 2 additions & 0 deletions godox.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package godox is a linter that scans Go code for comments containing certain keywords
// (like TODO, BUG, FIXME) which typically indicate areas that require attention.
package godox

import (
Expand Down
Loading