Skip to content

Commit

Permalink
Bumping golang version to v1.20.3 and making golint happy
Browse files Browse the repository at this point in the history
Signed-off-by: sethiyash <yashsethiya97@gmail.com>
  • Loading branch information
sethiyash committed May 8, 2023
1 parent b79ea5c commit 1f4b031
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3.3.0
- uses: actions/setup-go@v3 # default version of go is 1.10
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Install Carvel Tools
run: ./hack/install-deps.sh
# Run benchmark with `go test -bench` and stores the output to a file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Update Dependencies File
run: go run ./hack/dependencies.go update
- name: Create Pull Request
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- uses: actions/checkout@v3.3.0
with:
fetch-depth: '0'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.50.1
version: v1.52.2
args: -v
2 changes: 1 addition & 1 deletion .github/workflows/release-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"

- name: Run release script
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Check out code
uses: actions/checkout@v3.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-kctrl-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Check out code
uses: actions/checkout@v3.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Build the kapp-controller artifacts
run: |
./hack/install-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
go-version: "1.20.3"
- name: Check out code
uses: actions/checkout@v3.3.0
- name: Install Carvel Tools
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.19.6 AS deps
FROM --platform=$BUILDPLATFORM golang:1.20.3 AS deps

ARG TARGETOS TARGETARCH KCTRL_VER=development
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/carvel-kapp-controller/cli

go 1.19
go 1.20

require (
github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/carvel-kapp-controller

go 1.19
go 1.20

require (
github.com/fatih/color v1.13.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/app_reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (f FakeComponentInfo) KappControllerVersion() (semver.Version, error) {
return f.KCVersion, nil
}

func (f FakeComponentInfo) KubernetesVersion(serviceAccountName string, specCluster *v1alpha1.AppCluster, objMeta *metav1.ObjectMeta) (semver.Version, error) {
func (f FakeComponentInfo) KubernetesVersion(_ string, _ *v1alpha1.AppCluster, _ *metav1.ObjectMeta) (semver.Version, error) {
*f.K8sVersionCount++
return f.K8sVersion, nil
}
2 changes: 1 addition & 1 deletion pkg/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ func (f FakeComponentInfo) KappControllerVersion() (semver.Version, error) {
return f.KCVersion, nil
}

func (f FakeComponentInfo) KubernetesVersion(serviceAccountName string, specCluster *v1alpha1.AppCluster, objMeta *metav1.ObjectMeta) (semver.Version, error) {
func (f FakeComponentInfo) KubernetesVersion(_ string, _ *v1alpha1.AppCluster, _ *metav1.ObjectMeta) (semver.Version, error) {
return f.K8sVersion, nil
}
2 changes: 1 addition & 1 deletion pkg/config/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (r *Reconciler) AttachWatches(controller controller.Controller, ns string)
}

// Reconcile gets the current config from the cluster and applies any changes.
func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {
func (r *Reconciler) Reconcile(_ context.Context, request reconcile.Request) (reconcile.Result, error) {
log := r.log.WithValues("request", request)

err := r.config.Reload()
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type KappConfiguration interface {

// NewFactory returns deploy factory.
func NewFactory(coreClient kubernetes.Interface, kubeconfig *kubeconfig.Kubeconfig,
kappConfig KappConfiguration, cmdRunner exec.CmdRunner, log logr.Logger) Factory {
kappConfig KappConfiguration, cmdRunner exec.CmdRunner, _ logr.Logger) Factory {

return Factory{coreClient, kappConfig, kubeconfig, cmdRunner}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/packageinstall/packageinstall_deletion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ func (f FakeComponentInfo) KappControllerVersion() (semver.Version, error) {
return f.KCVersion, nil
}

func (f FakeComponentInfo) KubernetesVersion(serviceAccountName string, specCluster *v1alpha1.AppCluster, objMeta *metav1.ObjectMeta) (semver.Version, error) {
func (f FakeComponentInfo) KubernetesVersion(_ string, _ *v1alpha1.AppCluster, _ *metav1.ObjectMeta) (semver.Version, error) {
return f.K8sVersion, nil
}
2 changes: 1 addition & 1 deletion pkg/satoken/token_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ type fakeTokenGetter struct {
err error
}

func (ftg *fakeTokenGetter) getToken(name, namespace string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
func (ftg *fakeTokenGetter) getToken(_, _ string, _ *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
ftg.count++
return ftg.tr, ftg.err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/sidecarexec/os_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewOSConfig(log logr.Logger) OSConfig {

// ApplyCACerts atomically updates existing CA certs file
// with additional CA certs provided.
func (r OSConfig) ApplyCACerts(chain string, unusedResult *int) error {
func (r OSConfig) ApplyCACerts(chain string, _ *int) error {
r.log.Info("Applying CA certs")

origCopyFile, err := os.Open(r.CACertsLoc.OrigCopyPath)
Expand Down Expand Up @@ -94,7 +94,7 @@ type ProxyInput struct {
}

// ApplyProxy sets proxy related environment variables.
func (r OSConfig) ApplyProxy(in ProxyInput, unusedResult *int) error {
func (r OSConfig) ApplyProxy(in ProxyInput, _ *int) error {
vals := map[string]string{
"http_proxy": in.HTTPProxy,
"https_proxy": in.HTTPSProxy,
Expand Down
14 changes: 7 additions & 7 deletions pkg/sidecarexec/os_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
)

func Test_TrustedCertsCreateConfig(t *testing.T) {
backup, certs, close, err := createCertTempFiles(t)
backup, certs, closeFile, err := createCertTempFiles(t)
assert.NoError(t, err)
defer close()
defer closeFile()

backup.Write([]byte("existing-cert"))

Expand All @@ -36,9 +36,9 @@ func Test_TrustedCertsCreateConfig(t *testing.T) {
}

func Test_TrustedCertsUpdateConfig(t *testing.T) {
backup, certs, close, err := createCertTempFiles(t)
backup, certs, closeFile, err := createCertTempFiles(t)
assert.NoError(t, err)
defer close()
defer closeFile()

backup.Write([]byte("existing-cert"))

Expand Down Expand Up @@ -66,9 +66,9 @@ func Test_TrustedCertsUpdateConfig(t *testing.T) {
}

func Test_TrustedCertsDeleteConfig(t *testing.T) {
backup, certs, close, err := createCertTempFiles(t)
backup, certs, closeFile, err := createCertTempFiles(t)
assert.NoError(t, err)
defer close()
defer closeFile()

backup.Write([]byte("existing-cert"))

Expand All @@ -89,7 +89,7 @@ func Test_TrustedCertsDeleteConfig(t *testing.T) {
assert.Equal(t, string(contents), "existing-cert\n")
}

func createCertTempFiles(t *testing.T) (backup *os.File, certs *os.File, close func(), err error) {
func createCertTempFiles(_ *testing.T) (backup *os.File, certs *os.File, close func(), err error) {
backup, err = os.CreateTemp("", "backup.crt")
if err != nil {
return nil, nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/template/cue.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c *cue) TemplateDir(dirPath string) (exec.CmdRunResult, bool) {

// TemplateStream works on a stream returning templating result.
// dirPath is provided for context from which to reference additional inputs.
func (c *cue) TemplateStream(stream io.Reader, dirPath string) exec.CmdRunResult {
func (c *cue) TemplateStream(_ io.Reader, _ string) exec.CmdRunResult {
return exec.NewCmdRunResultWithErr(fmt.Errorf("Templating stream is not supported")) // TODO: Implement
}

Expand Down

0 comments on commit 1f4b031

Please sign in to comment.