Skip to content

Commit

Permalink
Upating linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed Mar 7, 2023
1 parent c897c3e commit 45bb422
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 46 deletions.
27 changes: 0 additions & 27 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
args: --disable=errcheck --timeout=5m
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ build:

# Run all lint checking with exit codes for CI
lint:
golint -set_exit_status `go list ./... | grep -v /vendor/`
golangci-lint run --disable=errcheck --timeout=5m

# Run tests with coverage reporting
test:
# @todo, Unit tests for marshalling.

.PHONY: build lint test
.PHONY: build lint
11 changes: 8 additions & 3 deletions internal/datasources/apps/v1/deployment/image/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ func Read(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagn

deployment, err := conn.Kubernetes().AppsV1().Deployments(namespace).Get(ctx, name, metav1.GetOptions{})
if kerrors.IsNotFound(err) {
d.Set(FieldResult, fallback)
return nil
if err := d.Set(FieldResult, fallback); err != nil {
return diag.FromErr(err)
}

return diags
} else if err != nil {
return diag.FromErr(err)
}
Expand All @@ -51,7 +54,9 @@ func Read(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagn

result := getImage(deployment.Spec.Template.Spec.Containers, container, fallback)

d.Set(FieldResult, result)
if err := d.Set(FieldResult, result); err != nil {
return diag.FromErr(err)
}

return diags
}
2 changes: 1 addition & 1 deletion internal/interfaceutils/interfaceutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package interfaceutils

// ExpandSlice converts an interface slice to a string slice.
func ExpandSlice(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/core/v1/pod/container/args/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package args

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/core/v1/pod/container/command/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package command

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/rbac/v1/role/rule/apigroups/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package apigroups

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
if v == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package resourcenames

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/rbac/v1/role/rule/resources/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package resources

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/rbac/v1/role/rule/verbs/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package verbs

// Expand will return a structured object.
func Expand(s []interface{}) []string {
result := make([]string, len(s), len(s))
result := make([]string, len(s))

for k, v := range s {
result[k] = v.(string)
Expand Down
3 changes: 1 addition & 2 deletions internal/terraform/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform/terraform"
"github.com/pkg/errors"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand All @@ -31,7 +30,7 @@ func Func(d *schema.ResourceData) (interface{}, error) {
cfg := &rest.Config{}

// Overriding with static configuration
cfg.UserAgent = fmt.Sprintf("HashiCorp/1.0 Terraform/%s", terraform.VersionString())
cfg.UserAgent = "HashiCorp/1.0 Terraform"

if v, ok := d.GetOk(FieldHost); ok {
cfg.Host = v.(string)
Expand Down

0 comments on commit 45bb422

Please sign in to comment.