Skip to content

Commit

Permalink
Bumping go version to 1.20.5 (#769)
Browse files Browse the repository at this point in the history
* Bumping golang 1.20.3 and golint changes (#743)

Signed-off-by: sethiyash <yashsethiya97@gmail.com>

* Bumping Go version to 1.20.4 (#759)

Signed-off-by: sethiyash <yashsethiya97@gmail.com>

* Bumping go version to 1.20.5 (#763)

Signed-off-by: sethiyash <yashsethiya97@gmail.com>

* making go lint happy

Signed-off-by: sethiyash <yashsethiya97@gmail.com>

---------

Signed-off-by: sethiyash <yashsethiya97@gmail.com>
  • Loading branch information
sethiyash authored Jun 15, 2023
1 parent 278e1d5 commit 0e2e052
Show file tree
Hide file tree
Showing 28 changed files with 101 additions and 96 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- name: Install Go 1.19
uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.6
go-version: 1.20.5
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.48.0
version: v1.52.2
args: -v
94 changes: 49 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
kappreleaser:
name: kapp release
runs-on: ubuntu-latest
# Set permissions of github token. See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -18,52 +21,24 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.6

- name: Build kapp Script
run: |
./hack/build-binaries.sh
shasum -a 256 ./kapp-* | tee checksums.txt
echo "# :open_file_folder: Files Checksum" | tee checksums-formatted.txt
echo \`\`\` | tee -a checksums-formatted.txt
cat checksums.txt | tee -a checksums-formatted.txt
echo \`\`\` | tee -a checksums-formatted.txt
- name: Setup Minikube
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker --memory 4096
eval $(minikube docker-env --shell=bash)
# Ensure that there is no existing kapp installed
rm -f /tmp/bin/kapp
- name: Add kapp binary to the Path
go-version: 1.20.5
- name: Retrieve version
run: |
mkdir bin
mv kapp bin
echo "$PWD/bin" >> $GITHUB_PATH
echo $GITHUB_PATH
echo "TAG_NAME=$(echo ${{ github.ref }} | grep -Eo 'v[0-9].*')" >> $GITHUB_OUTPUT
id: version

- name: Run test cases
run: |
./hack/test-external.sh
- name: Upload binaries and create draft Release
uses: softprops/action-gh-release@v1
- name: Run GoReleaser
# GoReleaser v4.2.0
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
body_path: ./checksums-formatted.txt
files: |
kapp-*
checksums.txt
draft: true
prerelease: true
version: 1.16.2
args: release --rm-dist --debug ${{ env.SKIP_PUBLISH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}

- name: Get uploaded release YAML checksum
uses: actions/github-script@v4
- uses: actions/github-script@v4
id: get-checksums-from-draft-release
if: startsWith(github.ref, 'refs/tags/')
with:
Expand Down Expand Up @@ -104,6 +79,7 @@ jobs:
}
}
console.log(checksums)
return `${checksums['kapp-darwin-amd64']} ./kapp-darwin-amd64
${checksums['kapp-darwin-arm64']} ./kapp-darwin-arm64
${checksums['kapp-linux-amd64']} ./kapp-linux-amd64
Expand All @@ -114,11 +90,39 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
run: |
set -e -x
cat ./checksums.txt
diff ./checksums.txt <(cat <<EOF
VERSION=`echo "$CURRENT_TAG" | grep -Eo '[0-9].*'`
./hack/build-binaries.sh "$VERSION" > ./go-checksums
cat ./go-checksums
diff ./go-checksums <(cat <<EOF
${{steps.get-checksums-from-draft-release.outputs.result}}
EOF
)
- name: Run Test cases
run: |
# Setup minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker --memory 4096
eval $(minikube docker-env --shell=bash)
# Ensure that there is no existing kapp installed
rm -f /tmp/bin/kapp
# Build kapp binary
set -e -x
VERSION=`echo ${{ github.ref }} | grep -Eo '[0-9].*'`
./hack/build.sh
# Add binary to the path
mkdir bin
mv kapp bin
PATH=$PATH:$PWD/bin
echo $PATH
# Run test cases
./hack/test-external.sh
6 changes: 3 additions & 3 deletions .github/workflows/test-gh-k8s-1.16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
name: Test GH
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.6
go-version: 1.20.5
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
name: Test GH
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.6
go-version: 1.20.5
- name: Check out code into the Go module directory
uses: actions/checkout@v2
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 @@ -10,7 +10,7 @@ jobs:
with:
repo: carvel-dev/kapp
tool: kapp
goVersion: 1.19.6
goVersion: 1.20.5
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL }}
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

go 1.19
go 1.20

require (
github.com/cppforlife/cobrautil v0.0.0-20220907150944-da5ee3a6ab1f
Expand Down
8 changes: 5 additions & 3 deletions pkg/kapp/app/labeled_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ func (a *LabeledApp) UsedGVs() ([]schema.GroupVersion, error)
func (a *LabeledApp) UsedGKs() (*[]schema.GroupKind, error) { return nil, nil }
func (a *LabeledApp) UpdateUsedGVsAndGKs([]schema.GroupVersion, []schema.GroupKind) error { return nil }

func (a *LabeledApp) CreateOrUpdate(labels map[string]string, isDiffRun bool) error { return nil }
func (a *LabeledApp) Exists() (bool, string, error) { return true, "", nil }
func (a *LabeledApp) CreateOrUpdate(_ map[string]string, _ bool) error {
return nil
}
func (a *LabeledApp) Exists() (bool, string, error) { return true, "", nil }

func (a *LabeledApp) Delete() error {
labelSelector, err := a.LabelSelector()
Expand Down Expand Up @@ -79,6 +81,6 @@ func (a *LabeledApp) Meta() (Meta, error) { return Meta{}, nil }
func (a *LabeledApp) Changes() ([]Change, error) { return nil, nil }
func (a *LabeledApp) LastChange() (Change, error) { return nil, nil }
func (a *LabeledApp) BeginChange(ChangeMeta) (Change, error) { return NoopChange{}, nil }
func (a *LabeledApp) GCChanges(max int, reviewFunc func(changesToDelete []Change) error) (int, int, error) {
func (a *LabeledApp) GCChanges(_ int, _ func(changesToDelete []Change) error) (int, int, error) {
return 0, 0, nil
}
2 changes: 1 addition & 1 deletion pkg/kapp/clusterapply/converged_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ var (
uiWaitChildMsgPrefix = " " + uiWaitMsgPrefix
)

func (c ConvergedResource) buildParentDescMsg(res ctlres.Resource, state ctlresm.DoneApplyState) []string {
func (c ConvergedResource) buildParentDescMsg(_ ctlres.Resource, state ctlresm.DoneApplyState) []string {
if len(state.Message) > 0 {
return []string{uiWaitMsgPrefix + state.Message}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/app/deploy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewDeployConfigOptions(ui ui.UI, depsFactory cmdcore.DepsFactory) *DeployCo
return &DeployConfigOptions{ui: ui, depsFactory: depsFactory}
}

func NewDeployConfigCmd(o *DeployConfigOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Command {
func NewDeployConfigCmd(o *DeployConfigOptions, _ cmdcore.FlagsFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "deploy-config",
Short: "Show default deploy config",
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/core/generate_name_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type GenerateNameFlags struct {
GenerateName bool
}

func (s *GenerateNameFlags) Set(cmd *cobra.Command, flagsFactory FlagsFactory) {
func (s *GenerateNameFlags) Set(cmd *cobra.Command, _ FlagsFactory) {
cmd.Flags().BoolVar(&s.GenerateName, "generate-name", false, "Set to generate name")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/core/kube_api_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type KubeAPIFlags struct {
Burst int
}

func (f *KubeAPIFlags) Set(cmd *cobra.Command, flagsFactory FlagsFactory) {
func (f *KubeAPIFlags) Set(cmd *cobra.Command, _ FlagsFactory) {
// Similar names are used by kubelet and other controllers
cmd.PersistentFlags().Float32Var(&f.QPS, "kube-api-qps", 1000, "Set Kubernetes API client QPS limit")
cmd.PersistentFlags().IntVar(&f.Burst, "kube-api-burst", 1000, "Set Kubernetes API client burst limit")
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/core/kubeconfig_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type KubeconfigFlags struct {
YAML *KubeconfigYAMLFlag
}

func (f *KubeconfigFlags) Set(cmd *cobra.Command, flagsFactory FlagsFactory) {
func (f *KubeconfigFlags) Set(cmd *cobra.Command, _ FlagsFactory) {
f.Path = NewKubeconfigPathFlag()
cmd.PersistentFlags().Var(f.Path, "kubeconfig", "Path to the kubeconfig file ($KAPP_KUBECONFIG)")

Expand Down
4 changes: 2 additions & 2 deletions pkg/kapp/cmd/core/unknown_bool_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ func (t ValueUnknownBool) String() string {
return ""
}

func (t ValueUnknownBool) Value() uitable.Value { return t }
func (t ValueUnknownBool) Compare(other uitable.Value) int { panic("Never called") }
func (t ValueUnknownBool) Value() uitable.Value { return t }
func (t ValueUnknownBool) Compare(_ uitable.Value) int { panic("Never called") }
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/logger_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type LoggerFlags struct {
Debug bool
}

func (f *LoggerFlags) Set(cmd *cobra.Command, flagsFactory cmdcore.FlagsFactory) {
func (f *LoggerFlags) Set(cmd *cobra.Command, _ cmdcore.FlagsFactory) {
cmd.PersistentFlags().BoolVar(&f.Debug, "debug", false, "Include debug output")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/tools/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewDiffOptions(ui ui.UI, depsFactory cmdcore.DepsFactory) *DiffOptions {
return &DiffOptions{ui: ui, depsFactory: depsFactory}
}

func NewDiffCmd(o *DiffOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Command {
func NewDiffCmd(o *DiffOptions, _ cmdcore.FlagsFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "diff",
Short: "Diff files against files2",
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/tools/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewInspectOptions(ui ui.UI, depsFactory cmdcore.DepsFactory) *InspectOption
return &InspectOptions{ui: ui, depsFactory: depsFactory}
}

func NewInspectCmd(o *InspectOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Command {
func NewInspectCmd(o *InspectOptions, _ cmdcore.FlagsFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "inspect",
Aliases: []string{"i"},
Expand Down
6 changes: 3 additions & 3 deletions pkg/kapp/cmd/tools/inspect_tree_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ type ValueColored struct {
Func func(string, ...interface{}) string
}

func (t ValueColored) String() string { return t.S }
func (t ValueColored) Value() uitable.Value { return t }
func (t ValueColored) Compare(other uitable.Value) int { panic("Never called") }
func (t ValueColored) String() string { return t.S }
func (t ValueColored) Value() uitable.Value { return t }
func (t ValueColored) Compare(_ uitable.Value) int { panic("Never called") }

func (t ValueColored) Fprintf(w io.Writer, pattern string, rest ...interface{}) (int, error) {
return fmt.Fprintf(w, "%s", t.Func(pattern, rest...))
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/tools/list_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewListLabelsOptions(ui ui.UI, depsFactory cmdcore.DepsFactory, logger logg
return &ListLabelsOptions{ui: ui, depsFactory: depsFactory, logger: logger}
}

func NewListLabelsCmd(o *ListLabelsOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Command {
func NewListLabelsCmd(o *ListLabelsOptions, _ cmdcore.FlagsFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "list-labels",
Aliases: []string{"ls-labels"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/ui_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type UIFlags struct {
Columns []string
}

func (f *UIFlags) Set(cmd *cobra.Command, flagsFactory cmdcore.FlagsFactory) {
func (f *UIFlags) Set(cmd *cobra.Command, _ cmdcore.FlagsFactory) {
cmd.PersistentFlags().BoolVar(&f.Color, "color", true, "Set color output")
cmd.PersistentFlags().BoolVar(&f.JSON, "json", false, "Output as JSON")
cmd.PersistentFlags().BoolVarP(&f.NonInteractive, "yes", "y", false, "Assume yes for any prompt")
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewVersionOptions(ui ui.UI) *VersionOptions {
return &VersionOptions{ui}
}

func NewVersionCmd(o *VersionOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Command {
func NewVersionCmd(o *VersionOptions, _ cmdcore.FlagsFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print client version",
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/cmd/warning_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type WarningFlags struct {
Warnings bool
}

func (f *WarningFlags) Set(cmd *cobra.Command, flagsFactory cmdcore.FlagsFactory) {
func (f *WarningFlags) Set(cmd *cobra.Command, _ cmdcore.FlagsFactory) {
cmd.PersistentFlags().BoolVar(&f.Warnings, "warnings", true, "Show warnings")
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/kapp/diffgraph/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ func (c *Change) AllRules() ([]ChangeRule, error) {
}

func (c *Change) ApplicableRules() ([]ChangeRule, error) {
var upsert, delete bool
var isUpsert, isDelete bool

op := c.Change.Op()

switch op {
case ActualChangeOpUpsert:
upsert = true
isUpsert = true
case ActualChangeOpDelete:
delete = true
isDelete = true
case ActualChangeOpNoop:
default:
return nil, fmt.Errorf("Unknown change operation: %s", op)
Expand All @@ -206,15 +206,15 @@ func (c *Change) ApplicableRules() ([]ChangeRule, error) {

var applicableRules []ChangeRule
for _, rule := range rules {
if (upsert && rule.Action == ChangeRuleActionUpsert) ||
(delete && rule.Action == ChangeRuleActionDelete) {
if (isUpsert && rule.Action == ChangeRuleActionUpsert) ||
(isDelete && rule.Action == ChangeRuleActionDelete) {
applicableRules = append(applicableRules, rule)
}
}
return applicableRules, nil
}

func (cs Changes) MatchesRule(rule ChangeRule, exceptChange *Change) ([]*Change, error) {
func (cs Changes) MatchesRule(rule ChangeRule, _ *Change) ([]*Change, error) {
var result []*Change

for _, change := range cs {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/diffui/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type diffDataChange struct {
WaitingForIDs []string `json:"waitingForIDs"`
}

func (s *Server) mainHandler(w http.ResponseWriter, r *http.Request) {
func (s *Server) mainHandler(w http.ResponseWriter, _ *http.Request) {
changesGraph := s.opts.DiffDataFunc()

allChanges := changesGraph.All()
Expand Down
Loading

0 comments on commit 0e2e052

Please sign in to comment.