Skip to content
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
6 changes: 2 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: golangci-lint
on:
push:
tags:
- "v9.*"
- "v8.*"
pull_request:
types:
Expand All @@ -12,7 +11,6 @@ on:
- synchronize
branches:
- main
- v9
- v8
paths-ignore:
- "doc/**"
Expand All @@ -36,8 +34,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v1.64
args: -v --exclude-dirs cf --exclude-dirs fixtures --exclude-dirs plugin --exclude-dirs command/plugin
version: v2.4
args: -v
format:
name: Run go fmt
runs-on: ubuntu-latest
Expand Down
160 changes: 123 additions & 37 deletions .golangci.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,131 @@
{
"run": {
"concurrency": 4,
"timeout": "20m"
"formatters": {
"enable": [
"goimports"
],
"exclusions": {
"generated": "lax",
"paths": [
"integration/helpers/fake_server.go",
"command/plugin/*.go$",
"third_party$",
"builtin$",
"examples$",
"cf$",
"fixtures$",
"plugin$"
]
}
},
"issues": {
"max-same-issues": 0
},
"linters": {
"disable-all": true,
"default": "none",
"enable": [
"govet",
"goimports",
"errcheck",
"govet",
"ineffassign",
"staticcheck",
"unused",
"ineffassign"
]
},
"linters-settings": {},
"issues": {
"max-same-issues": 0,
"exclude-files": [
"integration/helpers/fake_server.go",
"command/plugin/*.go$"
"unused"
],
"exclude": [
"Error return value of `client.GetApplicationTasks` is not checked",
"Error return value of `logger.output.Stop` is not checked",
"Error return value of `request.ResetBody` is not checked",
"Error return value of `GinkgoWriter.Write` is not checked",
"Error return value of `c.terminalHelper.RestoreTerminal` is not checked",
"U1000: field `allproxy` is unused",
"U1000: field `dockerPassword` is unused",
"U1000: field `envCFStagingTimeout` is unused",
"U1000: field `envCFStartupTimeout` is unused",
"U1000: field `relatedCommands` is unused",
"U1000: field `usage` is unused",
"SA5008: duplicate struct tag \"choice\"",
"`allproxy` is unused",
"`dockerPassword` is unused",
"`envCFStagingTimeout` is unused",
"`envCFStartupTimeout` is unused",
"`relatedCommands` is unused",
"`usage` is unused"
]
}
"settings": {
"staticcheck": {
"checks": [
"all",
"-S1002",
"-S1005",
"-S1007",
"-S1009",
"-S1011",
"-S1012",
"-S1016",
"-S1020",
"-S1039",
"-ST1001",
"-ST1003",
"-ST1005",
"-ST1012",
"-ST1016",
"-QF1001",
"-QF1002",
"-QF1003",
"-QF1004",
"-QF1008",
"-QF1012",
"-SA5008"
]
}
},
"exclusions": {
"generated": "lax",
"paths": [
"integration/helpers/fake_server.go",
"command/plugin/*.go$",
"third_party$",
"builtin$",
"examples$",
"cf$",
"fixtures$",
"plugin$"
],
"presets": [
"comments",
"common-false-positives",
"legacy",
"std-error-handling"
],
"rules": [
{
"linters": ["unused"],
"text": "field usage is unused"
},
{
"linters": ["unused"],
"text": "field relatedCommands is unused"
},
{
"linters": ["unused"],
"text": "field allproxy is unused"
},
{
"linters": ["unused"],
"text": "field dockerPassword is unused"
},
{
"linters": ["unused"],
"text": "field envCFStagingTimeout is unused"
},
{
"linters": ["unused"],
"text": "field envCFStartupTimeout is unused"
},
{
"linters": ["errcheck"],
"text": "Error return value of `GinkgoWriter.Write` is not checked"
},
{
"linters": ["errcheck"],
"text": "Error return value of `client.GetApplicationTasks` is not checked"
},
{
"linters": ["errcheck"],
"text": "Error return value of `logger.output.Stop` is not checked"
},
{
"linters": ["errcheck"],
"text": "Error return value of `request.ResetBody` is not checked"
},
{
"linters": ["errcheck"],
"text": "Error return value of `c.terminalHelper.RestoreTerminal` is not checked"
}
]
}
},
"run": {
"concurrency": 4,
"timeout": "60m"
},
"version": "2"
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ integration-tests-full-ci: install-test-deps integration-cleanup

lint: format ## Runs all linters and formatters
@echo "Running linters..."
golangci-lint run --exclude-dirs cf --exclude-dirs fixtures --exclude-dirs plugin --exclude-dirs command/plugin
golangci-lint run -v
@echo "No lint errors!"

# TODO: version specific tagging for all these builds
Expand Down
3 changes: 1 addition & 2 deletions actor/v7action/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"

"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v7action"
. "code.cloudfoundry.org/cli/actor/v7action"
"code.cloudfoundry.org/cli/actor/v7action/v7actionfakes"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
Expand All @@ -18,7 +17,7 @@ var _ = Describe("Deployment Actions", func() {
var (
actor *Actor
executeErr error
warnings v7action.Warnings
warnings Warnings
returnedDeploymentGUID string
fakeCloudControllerClient *v7actionfakes.FakeCloudControllerClient
)
Expand Down
4 changes: 2 additions & 2 deletions actor/v7action/organization_quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var _ = Describe("Organization Quota Actions", func() {
var (
actor *Actor
fakeCloudControllerClient *v7actionfakes.FakeCloudControllerClient
trueValue bool = true
falseValue bool = false
trueValue = true
falseValue = false
)

BeforeEach(func() {
Expand Down
3 changes: 1 addition & 2 deletions actor/v7action/revisions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strconv"

"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v7action"
. "code.cloudfoundry.org/cli/actor/v7action"
"code.cloudfoundry.org/cli/actor/v7action/v7actionfakes"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
Expand Down Expand Up @@ -403,7 +402,7 @@ var _ = Describe("Revisions Actions", func() {
Describe("GetEnvironmentVariableGroupByRevision", func() {
var (
actor *Actor
environmentVariablesGroup v7action.EnvironmentVariableGroup
environmentVariablesGroup EnvironmentVariableGroup
executeErr error
fakeCloudControllerClient *v7actionfakes.FakeCloudControllerClient
fakeConfig *v7actionfakes.FakeConfig
Expand Down
21 changes: 10 additions & 11 deletions api/cloudcontroller/ccv3/buildpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
. "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
. "code.cloudfoundry.org/cli/resources"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/ghttp"
Expand Down Expand Up @@ -121,35 +120,35 @@ var _ = Describe("Buildpacks", func() {
Expect(executeErr).NotTo(HaveOccurred())

Expect(buildpacks).To(ConsistOf(
Buildpack{
resources.Buildpack{
Name: "ruby_buildpack",
GUID: "guid1",
Position: types.NullInt{Value: 1, IsSet: true},
Enabled: types.NullBool{Value: true, IsSet: true},
Locked: types.NullBool{Value: false, IsSet: true},
Stack: "windows64",
State: "AWAITING_UPLOAD",
Metadata: &Metadata{Labels: map[string]types.NullString{}},
Metadata: &resources.Metadata{Labels: map[string]types.NullString{}},
},
Buildpack{
resources.Buildpack{
Name: "staticfile_buildpack",
GUID: "guid2",
Position: types.NullInt{Value: 2, IsSet: true},
Enabled: types.NullBool{Value: false, IsSet: true},
Locked: types.NullBool{Value: true, IsSet: true},
Stack: "cflinuxfs4",
State: "AWAITING_UPLOAD",
Metadata: &Metadata{Labels: map[string]types.NullString{}},
Metadata: &resources.Metadata{Labels: map[string]types.NullString{}},
},
Buildpack{
resources.Buildpack{
Name: "go_buildpack",
GUID: "guid3",
Position: types.NullInt{Value: 3, IsSet: true},
Enabled: types.NullBool{Value: true, IsSet: true},
Locked: types.NullBool{Value: false, IsSet: true},
Stack: "cflinuxfs4",
State: "AWAITING_UPLOAD",
Metadata: &Metadata{Labels: map[string]types.NullString{}},
Metadata: &resources.Metadata{Labels: map[string]types.NullString{}},
},
))
Expect(warnings).To(ConsistOf("this is a warning", "this is another warning"))
Expand Down Expand Up @@ -203,9 +202,9 @@ var _ = Describe("Buildpacks", func() {

Describe("CreateBuildpack", func() {
var (
inputBuildpack Buildpack
inputBuildpack resources.Buildpack

bp Buildpack
bp resources.Buildpack
warnings Warnings
executeErr error
)
Expand All @@ -216,7 +215,7 @@ var _ = Describe("Buildpacks", func() {

When("the buildpack is successfully created", func() {
BeforeEach(func() {
inputBuildpack = Buildpack{
inputBuildpack = resources.Buildpack{
Name: "some-buildpack",
Stack: "some-stack",
}
Expand Down Expand Up @@ -259,7 +258,7 @@ var _ = Describe("Buildpacks", func() {
Expect(executeErr).NotTo(HaveOccurred())
Expect(warnings).To(ConsistOf("this is a warning"))

expectedBuildpack := Buildpack{
expectedBuildpack := resources.Buildpack{
GUID: "some-bp-guid",
Name: "some-buildpack",
Stack: "some-stack",
Expand Down
4 changes: 2 additions & 2 deletions api/cloudcontroller/ccv3/droplet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"code.cloudfoundry.org/cli/api/cloudcontroller"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"

. "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
Expand Down Expand Up @@ -433,7 +433,7 @@ var _ = Describe("Droplet", func() {
})

BeforeEach(func() {
requester.MakeRequestReceiveRawCalls(func(string, internal.Params, string) ([]byte, ccv3.Warnings, error) {
requester.MakeRequestReceiveRawCalls(func(string, internal.Params, string) ([]byte, Warnings, error) {
return []byte{'d', 'r', 'o', 'p'}, Warnings{"some-warning"}, errors.New("some-error")
})
})
Expand Down
Loading
Loading