Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Nil pointer error and update linter #389

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ linters:
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- contextcheck
- cyclop
- dogsled
Expand All @@ -26,7 +27,6 @@ linters:
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gci
- gocognit
Expand Down Expand Up @@ -112,9 +112,6 @@ linters-settings:
- name: unconditional-recursion
- name: waitgroup-by-value

unused:
go: "1.21"

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ help:

# -- Tooling

GOLANGCI_LINT_VERSION ?= v1.55.2
GOLANGCI_LINT_VERSION ?= v1.61.0
GOLANGCI_LINT := $(TOOLS_DIR)/golangci-lint
$(GOLANGCI_LINT):
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/flatfile/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestGetEC2Instance(t *testing.T) {
}

if !cmp.Equal(&ec2Instance, tc.ExpectedInstance) {
t.Errorf(cmp.Diff(ec2Instance, tc.ExpectedInstance))
t.Error(cmp.Diff(ec2Instance, tc.ExpectedInstance))
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions internal/backend/kubernetes/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ type listerClient interface {
func toEC2Instance(hw tinkv1.Hardware) ec2.Instance {
var i ec2.Instance

if hw.Spec.Metadata.Instance != nil {
if hw.Spec.Metadata != nil && hw.Spec.Metadata.Instance != nil {
i.Metadata.InstanceID = hw.Spec.Metadata.Instance.ID
i.Metadata.Hostname = hw.Spec.Metadata.Instance.Hostname
i.Metadata.LocalHostname = hw.Spec.Metadata.Instance.Hostname
Expand Down Expand Up @@ -195,7 +195,7 @@ func toEC2Instance(hw tinkv1.Hardware) ec2.Instance {
}
}

if hw.Spec.Metadata.Facility != nil {
if hw.Spec.Metadata != nil && hw.Spec.Metadata.Facility != nil {
i.Metadata.Plan = hw.Spec.Metadata.Facility.PlanSlug
i.Metadata.Facility = hw.Spec.Metadata.Facility.FacilityCode
}
Expand Down
Loading