Skip to content

Commit

Permalink
Upgrade to go 1.20
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot-Parab <prajyot.parab2@ibm.com>
  • Loading branch information
Prajyot-Parab committed Apr 24, 2023
1 parent 9b9ec3b commit 227ea1e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/controller-tools

go 1.19
go 1.20

require (
github.com/fatih/color v1.15.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/crd/gen_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type outputRule struct {
buf *bytes.Buffer
}

func (o *outputRule) Open(_ *loader.Package, itemPath string) (io.WriteCloser, error) {
func (o *outputRule) Open(_ *loader.Package, _ string) (io.WriteCloser, error) {
return nopCloser{o.buf}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/crd/markers/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ type Resource struct {
Scope string `marker:",optional"`
}

func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, _ string) error {
if s.Path != "" {
crd.Names.Plural = s.Path
}
Expand Down Expand Up @@ -362,7 +362,7 @@ type Metadata struct {
Labels []string `marker:",optional"`
}

func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, version string) error {
func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, _ string) error {
if len(s.Annotations) > 0 {
if crd.Annotations == nil {
crd.Annotations = map[string]string{}
Expand Down
11 changes: 7 additions & 4 deletions pkg/deepcopy/traverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,14 @@ func hasAnyDeepCopyMethod(pkg *loader.Package, typeInfo types.Type) bool {
// eventualUnderlyingType gets the "final" type in a sequence of named aliases.
// It's effectively a shortcut for calling Underlying in a loop.
func eventualUnderlyingType(typeInfo types.Type) types.Type {
last := typeInfo
for underlying := typeInfo.Underlying(); underlying != last; last, underlying = underlying, underlying.Underlying() {
// get the actual underlying type
for {
underlying := typeInfo.Underlying()
if underlying == typeInfo {
break
}
typeInfo = underlying
}
return last
return typeInfo
}

// fineToShallowCopy checks if a shallow-copying a type is equivalent to deepcopy-ing it.
Expand Down
2 changes: 1 addition & 1 deletion pkg/genall/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var OutputToStdout = outputToStdout{}
// Generally useful for single-artifact outputs.
type outputToStdout struct{}

func (o outputToStdout) Open(_ *loader.Package, itemPath string) (io.WriteCloser, error) {
func (o outputToStdout) Open(_ *loader.Package, _ string) (io.WriteCloser, error) {
return nopCloser{os.Stdout}, nil
}

Expand Down
13 changes: 11 additions & 2 deletions pkg/markers/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@ func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument {
subScanner := parserScanner(subRaw, scanner.Error)

var tok rune
for tok = subScanner.Scan(); tok != ',' && tok != sc.EOF && tok != ';'; tok = subScanner.Scan() {
for {
tok = subScanner.Scan()
if tok == ',' || tok == sc.EOF || tok == ';' {
break
}
// wait till we get something interesting
}

Expand Down Expand Up @@ -495,7 +499,12 @@ func (a *Argument) parse(scanner *sc.Scanner, raw string, out reflect.Value, inS
// raw consumes everything else
castAndSet(out, reflect.ValueOf(raw[scanner.Pos().Offset:]))
// consume everything else
for tok := scanner.Scan(); tok != sc.EOF; tok = scanner.Scan() {
var tok rune
for {
tok = scanner.Scan()
if tok == sc.EOF {
break
}
}
case NumberType:
nextChar := scanner.Peek()
Expand Down
7 changes: 2 additions & 5 deletions pkg/typescaffold/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,8 @@ type ScaffoldOptions struct {

// Validate validates the options, returning an error if anything is invalid.
func (o *ScaffoldOptions) Validate() error {
if err := o.Resource.Validate(); err != nil {
return err
}

return nil
err := o.Resource.Validate()
return err
}

// Scaffold prints the Kubernetes object scaffolding to the given output.
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function setup_envs {
header_text "using tools"

if ! which golangci-lint 2>&1 >/dev/null; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
export PATH=$PATH:$(go env GOPATH)/bin
fi

Expand Down

0 comments on commit 227ea1e

Please sign in to comment.