Skip to content

Commit

Permalink
bump golangci-lint to v1.56.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adityabhatia committed Feb 8, 2024
1 parent c9a40d3 commit c8327d4
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # tag=v3.7.0
with:
version: v1.55.2
version: v1.56.0
args: --out-format=colored-line-number
working-directory: ${{matrix.working-directory}}
2 changes: 1 addition & 1 deletion bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {

// String returns the string representation of the BootstrapTokenString.
func (bts BootstrapTokenString) String() string {
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
if bts.ID != "" && bts.Secret != "" {
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
}
return ""
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/kubeadm/api/v1beta1/kubeadm_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
var err error
newbts := &BootstrapTokenString{}
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
if len(input) > 0 {
if input != "" {
if err := json.Unmarshal([]byte(input), newbts); err != nil {
return errors.Wrap(err, "expected no unmarshal error, got error")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {

// String returns the string representation of the BootstrapTokenString.
func (bts BootstrapTokenString) String() string {
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
if bts.ID != "" && bts.Secret != "" {
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
}
return ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
var err error
newbts := &BootstrapTokenString{}
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
if len(input) > 0 {
if input != "" {
if err := json.Unmarshal([]byte(input), newbts); err != nil {
return errors.Wrap(err, "expected no unmarshal error, got error")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error {

// String returns the string representation of the BootstrapTokenString.
func (bts BootstrapTokenString) String() string {
if len(bts.ID) > 0 && len(bts.Secret) > 0 {
if bts.ID != "" && bts.Secret != "" {
return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret)
}
return ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func roundtrip(input string, bts *BootstrapTokenString) error {
var err error
newbts := &BootstrapTokenString{}
// If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string
if len(input) > 0 {
if input != "" {
if err := json.Unmarshal([]byte(input), newbts); err != nil {
return errors.Wrap(err, "expected no unmarshal error, got error")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/cluster/mover.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ func (o *objectMover) createTargetObject(ctx context.Context, nodeToCreate *node

// FIXME Workaround for https://github.com/kubernetes/kubernetes/issues/32220. Remove when the issue is fixed.
// If the resource already exists, the API server ordinarily returns an AlreadyExists error. Due to the above issue, if the resource has a non-empty metadata.generateName field, the API server returns a ServerTimeoutError. To ensure that the API server returns an AlreadyExists error, we set the metadata.generateName field to an empty string.
if len(obj.GetName()) > 0 && len(obj.GetGenerateName()) > 0 {
if obj.GetName() != "" && obj.GetGenerateName() != "" {
obj.SetGenerateName("")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func printVariablesOutput(template client.Template, options client.GetClusterTem
if variableMap[name] != nil {
v := *variableMap[name]
// Add quotes around any unquoted strings
if len(v) > 0 && !strings.HasPrefix(v, "\"") {
if v != "" && !strings.HasPrefix(v, "\"") {
v = fmt.Sprintf("%q", v)
variableMap[name] = &v
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (l *logger) V(level int) logr.LogSink {
// WithName adds a new element to the logger's name.
func (l *logger) WithName(name string) logr.LogSink {
nl := l.clone()
if len(l.prefix) > 0 {
if l.prefix != "" {
nl.prefix = l.prefix + "/"
}
nl.prefix += name
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/topology/cluster/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ func templateToObject(in templateToInput) (*unstructured.Unstructured, error) {
return nil, errors.Wrapf(err, "failed to generate name for %s", object.GetKind())
}
object.SetName(name)
if in.currentObjectRef != nil && len(in.currentObjectRef.Name) > 0 {
if in.currentObjectRef != nil && in.currentObjectRef.Name != "" {
object.SetName(in.currentObjectRef.Name)
}

Expand Down Expand Up @@ -1338,7 +1338,7 @@ func templateToTemplate(in templateToInput) (*unstructured.Unstructured, error)
return nil, errors.Wrapf(err, "failed to generate name for %s", template.GetKind())
}
template.SetName(name)
if in.currentObjectRef != nil && len(in.currentObjectRef.Name) > 0 {
if in.currentObjectRef != nil && in.currentObjectRef.Name != "" {
template.SetName(in.currentObjectRef.Name)
}

Expand Down

0 comments on commit c8327d4

Please sign in to comment.