Skip to content

Commit

Permalink
Update golangci-lint version and fix new warnings (#7951)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytimocin authored Sep 21, 2024
1 parent a7395fb commit cf639b4
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: "v1.57.2"
version: "v1.61.0"
args: --timeout=10m
skip-cache: true
install-mode: "binary"
Expand Down
4 changes: 1 addition & 3 deletions cmd/rad/cmd/bicepDownload.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package cmd

import (
"fmt"

"github.com/radius-project/radius/pkg/cli/bicep"
"github.com/radius-project/radius/pkg/cli/output"
"github.com/radius-project/radius/pkg/version"
Expand All @@ -30,7 +28,7 @@ var bicepDownloadCmd = &cobra.Command{
Short: "Download the bicep compiler",
Long: `Downloads the bicep compiler locally`,
RunE: func(cmd *cobra.Command, args []string) error {
output.LogInfo(fmt.Sprintf("Downloading Bicep for channel %s...", version.Channel()))
output.LogInfo("Downloading Bicep for channel %s...", version.Channel())
err := bicep.DownloadBicep()
return err
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/rad/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var versionCmd = &cobra.Command{
outFormat, _ := cmd.Flags().GetString("output")
writeVersionString(outFormat, cmd.OutOrStdout())
} else {
output.LogInfo(version.Version())
output.LogInfo("%s", version.Version())
}
return nil
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ However, you can also install all tools locally. This is the list of core depend
- [Node.js](https://nodejs.org/en/)
- [Python](https://www.python.org/downloads/)
- [Golangci-lint](https://golangci-lint.run/usage/install/#local-installation)
- [jq](https://jqlang.github.io/jq/download/)
- Make
- [jq](https://jqlang.github.io/jq/download/)
- Make

### Install make

For `make` we advice the following installation steps depending on you OS.
Expand All @@ -48,13 +48,13 @@ sudo apt-get install build-essential

Using Xcode:

```bash
```bash
xcode-select --install
```

Using Homebrew:

```bash
```bash
brew install make
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Your first pull request

At this point you've experienced the basic dev flow for the `rad` CLI.
At this point you've experienced the basic dev flow for the `rad` CLI.

It's time to pick an issue to work on! You can find a query [here](https://github.com/radius-project/radius/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).

## Etiquette for issues

If you find an issue you want to help with, then please comment on that issue and ask for one of the maintainers to assign it to you. If you have questions or anything you want to discuss, use the issue to communicate about it.

Now you've got something to work on. Once you've developed and tested your change resume this guide.
Now you've got something to work on. Once you've developed and tested your change resume this guide.

## One last check

Expand Down Expand Up @@ -64,10 +64,10 @@ At this point you should review the PR checks and make sure they pass. Failing P

If you have any failing checks try to investigate the details and solve them if possible. If you get stuck and need to know the reason for failure, ask a maintainer.

At this point one or more core team members will review your code changes.
At this point one or more core team members will review your code changes.

Reviewers will leave their feedback via comments. Discuss as needed and resolve the feedback when both you and the reviewers are happy.

Once you've resolved all the feedback, your reviewers will make the pull request as approved.

From this point on you don't need to do anything. The maintainers will merge your pull request.
From this point on you don't need to do anything. The maintainers will merge your pull request.
13 changes: 7 additions & 6 deletions pkg/armrpc/asyncoperation/statusmanager/statusmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package statusmanager

import (
"context"
"errors"
"fmt"
"testing"
"time"
Expand Down Expand Up @@ -131,21 +132,21 @@ func TestCreateAsyncOperationStatus(t *testing.T) {
},
{
Desc: "create_save-error",
SaveErr: fmt.Errorf(saveErr),
SaveErr: errors.New(saveErr),
EnqueueErr: nil,
DeleteErr: nil,
},
{
Desc: "create_enqueue-error",
SaveErr: nil,
EnqueueErr: fmt.Errorf(enqueueErr),
EnqueueErr: errors.New(enqueueErr),
DeleteErr: nil,
},
{
Desc: "create_delete-error",
SaveErr: nil,
EnqueueErr: fmt.Errorf(enqueueErr),
DeleteErr: fmt.Errorf(deleteErr),
EnqueueErr: errors.New(enqueueErr),
DeleteErr: errors.New(deleteErr),
},
}

Expand Down Expand Up @@ -202,7 +203,7 @@ func TestDeleteAsyncOperationStatus(t *testing.T) {
},
{
Desc: "delete_error",
DeleteErr: fmt.Errorf(deleteErr),
DeleteErr: errors.New(deleteErr),
},
}

Expand Down Expand Up @@ -241,7 +242,7 @@ func TestGetAsyncOperationStatus(t *testing.T) {
},
{
Desc: "create_enqueue-error",
GetErr: fmt.Errorf(getErr),
GetErr: errors.New(getErr),
Obj: nil,
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/bicep/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (*Impl) PrepareTemplate(filePath string) (map[string]any, error) {
}

if !ok {
output.LogInfo(fmt.Sprintf("Downloading Bicep for channel %s...", version.Channel()))
output.LogInfo("Downloading Bicep for channel %s...", version.Channel())
err = DownloadBicep()
if err != nil {
return nil, fmt.Errorf("failed to download rad-bicep: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/clivalidation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_RequireResourceType(t *testing.T) {
name: "Unsupported resource type",
args: []string{"unsupported"},
want: "",
wantErr: fmt.Errorf("'unsupported' is not a valid resource type. Available Types are: \n\n" + resourceTypesErrorString + "\n"),
wantErr: fmt.Errorf("'unsupported' is not a valid resource type. Available Types are: \n\n%s\n", resourceTypesErrorString),
},
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func DeployWithProgress(ctx context.Context, options Options) (clients.Deploymen
return clients.DeploymentResult{}, err
}

step := output.BeginStep(options.ProgressText)
step := output.BeginStep("%s", options.ProgressText)
output.LogInfo("")

// Watch for progress while we're deploying.
Expand Down Expand Up @@ -65,15 +65,15 @@ func DeployWithProgress(ctx context.Context, options Options) (clients.Deploymen
output.LogInfo("")
output.CompleteStep(step)

output.LogInfo(options.CompletionText)
output.LogInfo("%s", options.CompletionText)
output.LogInfo("")

if len(result.Resources) > 0 {
output.LogInfo("Resources:")

for _, resource := range result.Resources {
if output.ShowResource(resource) {
output.LogInfo(" " + output.FormatResourceForDisplay(resource))
output.LogInfo(" %s", output.FormatResourceForDisplay(resource))
}
}
var diagnosticsClient clients.DiagnosticsClient
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func helmChartFromContainerRegistry(version string, config *helm.Configuration,
return nil, clierrors.Message("recieved 403 unauthorized when downloading helm chart from the registry. you may want to perform a `docker logout ghcr.io` and re-try the command")
}

return nil, clierrors.MessageWithCause(err, fmt.Sprintf("error downloading helm chart from the registry for version: %s, release name: %s", version, releaseName))
return nil, clierrors.MessageWithCause(err, "error downloading helm chart from the registry for version: %s, release name: %s", version, releaseName)
}

chartPath, err := locateChartFile(dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (src *DaprConfigurationStoreResource) ConvertTo() (v1.DataModelInterface, e
if src.Properties.Recipe != nil && (!reflect.ValueOf(*src.Properties.Recipe).IsZero()) {
msgs = append(msgs, "recipe details cannot be specified when resourceProvisioning is set to manual")
}
if src.Properties.Metadata == nil || len(src.Properties.Metadata) == 0 {
if len(src.Properties.Metadata) == 0 {
msgs = append(msgs, "metadata must be specified when resourceProvisioning is set to manual")
}
if src.Properties.Type == nil || *src.Properties.Type == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daprrp/api/v20231001preview/pubsubbroker_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (src *DaprPubSubBrokerResource) ConvertTo() (v1.DataModelInterface, error)
if src.Properties.Recipe != nil && (!reflect.ValueOf(*src.Properties.Recipe).IsZero()) {
msgs = append(msgs, "recipe details cannot be specified when resourceProvisioning is set to manual")
}
if src.Properties.Metadata == nil || len(src.Properties.Metadata) == 0 {
if len(src.Properties.Metadata) == 0 {
msgs = append(msgs, "metadata must be specified when resourceProvisioning is set to manual")
}
if src.Properties.Type == nil || *src.Properties.Type == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daprrp/api/v20231001preview/secretstore_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (src *DaprSecretStoreResource) ConvertTo() (v1.DataModelInterface, error) {
if src.Properties.Recipe != nil && (!reflect.ValueOf(*src.Properties.Recipe).IsZero()) {
msgs = append(msgs, "recipe details cannot be specified when resourceProvisioning is set to manual")
}
if src.Properties.Metadata == nil || len(src.Properties.Metadata) == 0 {
if len(src.Properties.Metadata) == 0 {
msgs = append(msgs, "metadata must be specified when resourceProvisioning is set to manual")
}
if src.Properties.Type == nil || *src.Properties.Type == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daprrp/api/v20231001preview/statestore_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (src *DaprStateStoreResource) ConvertTo() (v1.DataModelInterface, error) {
if src.Properties.Recipe != nil && (!reflect.ValueOf(*src.Properties.Recipe).IsZero()) {
msgs = append(msgs, "recipe details cannot be specified when resourceProvisioning is set to manual")
}
if src.Properties.Metadata == nil || len(src.Properties.Metadata) == 0 {
if len(src.Properties.Metadata) == 0 {
msgs = append(msgs, "metadata must be specified when resourceProvisioning is set to manual")
}
if src.Properties.Type == nil || *src.Properties.Type == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/recipes/terraform/config/providers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func GetRecipeProviderConfigs(ctx context.Context, envConfig *recipes.Configurat
currentProviderConfig := make(map[string]any)

// Retrieve configuration details from 'AdditionalProperties' property and add to currentConfig.
if configDetails.AdditionalProperties != nil && len(configDetails.AdditionalProperties) > 0 {
if len(configDetails.AdditionalProperties) > 0 {
currentProviderConfig = configDetails.AdditionalProperties
}

Expand Down

0 comments on commit cf639b4

Please sign in to comment.