Skip to content

Commit

Permalink
Improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
damyan committed Sep 19, 2024
1 parent 321c329 commit 81f68f4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ docker-push: ## Push docker image with the manager.
docker push ${IMG}

.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
fmt: goimports ## Run goimports against code.
$(GOIMPORTS) -w .

.PHONY: vet
vet: ## Run go vet against code.
Expand Down Expand Up @@ -64,12 +64,14 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
GOIMPORTS ?= $(LOCALBIN)/goimports-$(GOIMPORTS_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
CONTROLLER_TOOLS_VERSION ?= v0.15.0
ENVTEST_VERSION ?= release-0.18
ENVTEST_VERSION ?= latest
GOLANGCI_LINT_VERSION ?= v1.61.0
GOIMPORTS_VERSION ?= v0.25.0

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand All @@ -91,6 +93,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})

.PHONY: goimports
goimports: $(GOIMPORTS) ## Download goimports locally if necessary.
$(GOIMPORTS): $(LOCALBIN)
$(call go-install-tool,$(GOIMPORTS),golang.org/x/tools/cmd/goimports,$(GOIMPORTS_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary (ideally with version)
# $2 - package url which can be installed
Expand Down
1 change: 1 addition & 0 deletions internal/kubernetes/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package kubernetes

import (
"fmt"

metalv1alpha1 "github.com/ironcore-dev/metal-operator/api/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ package main

import (
"fmt"
"github.com/ironcore-dev/fedhcp/internal/kubernetes"
"io"
"os"
"time"

"github.com/ironcore-dev/fedhcp/internal/kubernetes"

"github.com/coredhcp/coredhcp/config"
"github.com/coredhcp/coredhcp/logger"
"github.com/coredhcp/coredhcp/server"
Expand Down
9 changes: 5 additions & 4 deletions plugins/metal/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"net/netip"
"os"
"strings"

"github.com/coredhcp/coredhcp/handler"
"github.com/coredhcp/coredhcp/logger"
"github.com/coredhcp/coredhcp/plugins"
Expand All @@ -18,11 +23,7 @@ import (
metalv1alpha1 "github.com/ironcore-dev/metal-operator/api/v1alpha1"
"github.com/mdlayher/netx/eui64"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net"
"net/netip"
"os"
controllerruntime "sigs.k8s.io/controller-runtime"
"strings"
)

var log = logger.GetLogger("plugins/metal")
Expand Down
7 changes: 4 additions & 3 deletions plugins/metal/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ package metal

import (
"encoding/json"
"net"
"os"
"strings"

"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv6"
"github.com/ironcore-dev/fedhcp/internal/api"
Expand All @@ -16,10 +20,7 @@ import (
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net"
"os"
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
"strings"
)

var _ = Describe("Endpoint", func() {
Expand Down
9 changes: 5 additions & 4 deletions plugins/metal/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ package metal

import (
"fmt"
"github.com/ironcore-dev/controller-utils/modutils"
"github.com/ironcore-dev/fedhcp/internal/api"
"github.com/ironcore-dev/fedhcp/internal/kubernetes"
ipamv1alpha1 "github.com/ironcore-dev/ipam/api/ipam/v1alpha1"
"path/filepath"
"runtime"
"testing"
"time"

"github.com/ironcore-dev/controller-utils/modutils"
"github.com/ironcore-dev/fedhcp/internal/api"
"github.com/ironcore-dev/fedhcp/internal/kubernetes"
ipamv1alpha1 "github.com/ironcore-dev/ipam/api/ipam/v1alpha1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
Expand Down
3 changes: 2 additions & 1 deletion plugins/onmetal/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
package onmetal

import (
"github.com/insomniacslk/dhcp/dhcpv6"
"net"
"testing"

"github.com/insomniacslk/dhcp/dhcpv6"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion plugins/oob/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ package oob

import (
"fmt"
ipamv1alpha1 "github.com/ironcore-dev/ipam/api/ipam/v1alpha1"
"net"
"time"

ipamv1alpha1 "github.com/ironcore-dev/ipam/api/ipam/v1alpha1"

"github.com/coredhcp/coredhcp/handler"
"github.com/coredhcp/coredhcp/logger"
"github.com/coredhcp/coredhcp/plugins"
Expand Down

0 comments on commit 81f68f4

Please sign in to comment.