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

build(lint): use revive instead of golint #1801

Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool_name: golangci-lint

# Use golint via golangci-lint binary with "warning" level.
golint:
name: runner / golint
# Use revive via golangci-lint binary with "warning" level.
revive:
name: runner / revive
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: golint
- name: revive
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--disable-all -E golint"
tool_name: golint # Change reporter name.
golangci_lint_flags: "--disable-all -E revive"
tool_name: revive # Change reporter name.
level: warning # GitHub Status Check won't become failure with this level.

# You can add more and more supported linters with different config.
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linters:
# We don't use goconst because it gives false positives in the tests.
# - goconst
- gofmt
- golint
- revive
- gosec
- gosimple
- ineffassign
Expand Down
2 changes: 1 addition & 1 deletion server/core/locking/locking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func TestGetLock_NoOpLocker(t *testing.T) {
l := locking.NewNoOpLocker()
lock, err := l.GetLock("owner/repo/path/workspace")
Ok(t, err)
var expected *models.ProjectLock = nil
var expected *models.ProjectLock
Equals(t, expected, lock)
}

Expand Down
4 changes: 2 additions & 2 deletions server/core/runtime/policy/conftest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (p *SourceResolverProxy) Resolve(policySet valid.PolicySet) (string, error)
case valid.LocalPolicySet:
return p.localSourceResolver.Resolve(policySet)
default:
return "", errors.New(fmt.Sprintf("unable to resolve policy set source %s", source))
return "", fmt.Errorf("unable to resolve policy set source %s", source)
}
}

Expand Down Expand Up @@ -237,7 +237,7 @@ func getDefaultVersion() (*version.Version, error) {
defaultVersion, exists := os.LookupEnv(DefaultConftestVersionEnvKey)

if !exists {
return nil, errors.New(fmt.Sprintf("%s not set.", DefaultConftestVersionEnvKey))
return nil, fmt.Errorf("%s not set", DefaultConftestVersionEnvKey)
}

wrappedVersion, err := version.NewVersion(defaultVersion)
Expand Down
6 changes: 3 additions & 3 deletions server/events/pre_workflow_hooks_command_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestRunPreHooks_Clone(t *testing.T) {
t.Run("success hooks in cfg", func(t *testing.T) {
preWorkflowHooksSetup(t)

var unlockCalled *bool = newBool(false)
var unlockCalled = newBool(false)
unlockFn := func() {
unlockCalled = newBool(true)
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func TestRunPreHooks_Clone(t *testing.T) {
t.Run("error cloning", func(t *testing.T) {
preWorkflowHooksSetup(t)

var unlockCalled *bool = newBool(false)
var unlockCalled = newBool(false)
unlockFn := func() {
unlockCalled = newBool(true)
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestRunPreHooks_Clone(t *testing.T) {
t.Run("error running pre hook", func(t *testing.T) {
preWorkflowHooksSetup(t)

var unlockCalled *bool = newBool(false)
var unlockCalled = newBool(false)
unlockFn := func() {
unlockCalled = newBool(true)
}
Expand Down
2 changes: 1 addition & 1 deletion server/events/yaml/valid/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DeleteSourceBranchOnMergeKey = "delete_source_branch_on_merge"
// TODO: Make this more customizable, not everyone wants this rigid workflow
// maybe something along the lines of defining overridable/non-overrideable apply
// requirements in the config and removing the flag to enable policy checking.
var NonOverrideableApplyReqs []string = []string{PoliciesPassedApplyReq}
var NonOverrideableApplyReqs = []string{PoliciesPassedApplyReq}

// GlobalCfg is the final parsed version of server-side repo config.
type GlobalCfg struct {
Expand Down
2 changes: 1 addition & 1 deletion testdrive/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func execAndWaitForStderr(wg *sync.WaitGroup, stderrMatch *regexp.Regexp, timeou
cancel()
// We still need to wait for the command to finish.
command.Wait() // nolint: errcheck
return cancel, errChan, fmt.Errorf("timeout, logs:\n%s\n", log) // nolint: staticcheck, golint
return cancel, errChan, fmt.Errorf("timeout, logs:\n%s\n", log) // nolint: staticcheck, revive
}

// Increment the wait group so callers can wait for the command to finish.
Expand Down