Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
freggy committed Dec 10, 2024
1 parent 22bfeee commit 814ec66
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ linters-settings:
replacement: any
misspell:
locale: US
mode: restricted
exhaustive:
default-signifies-exhaustive: true
lll:
Expand All @@ -20,7 +21,6 @@ linters:
- gosimple
- goimports
- gomodguard
- errcheck
- whitespace
- staticcheck
- misspell
Expand Down
10 changes: 5 additions & 5 deletions cmd/platformd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ func main() {
logger = slog.New(slog.NewTextHandler(os.Stdout, nil))
fs = flag.NewFlagSet("platformd", flag.ContinueOnError)

proxyServiceListenSock = fs.String("management-server-listen-sock", "/var/run/platformd/platformd.sock", "path to the unix domain socket to listen on")
criListenSock = fs.String("cri-listen-sock", "/var/run/crio/crio.sock", "path to the unix domain socket the CRI is listening on")
envoyImage = fs.String("envoy-image", "", "container image to use for envoy")
getsockoptCgroup = fs.String("getsockopt-cgroup", "", "container image to use for coredns")
_ = fs.String("config", "/etc/platformd/config.json", "path to the config file")
proxyServiceListenSock = fs.String("management-server-listen-sock", "/var/run/platformd/platformd.sock", "path to the unix domain socket to listen on") //nolint:lll
criListenSock = fs.String("cri-listen-sock", "/var/run/crio/crio.sock", "path to the unix domain socket the CRI is listening on") //nolint:lll
envoyImage = fs.String("envoy-image", "", "container image to use for envoy") //nolint:lll
getsockoptCgroup = fs.String("getsockopt-cgroup", "", "container image to use for coredns") //nolint:lll
_ = fs.String("config", "/etc/platformd/config.json", "path to the config file") //nolint:lll
)
if err := ff.Parse(fs, os.Args[1:],
ff.WithEnvVarPrefix("PLATFORMD"),
Expand Down
2 changes: 1 addition & 1 deletion internal/cni/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var stdinData = []byte(`
}
`)

// TestSetup tests that ip address and mac adress could be allocated
// TestSetup tests that ip address and mac address could be allocated
// and configured on the veth-pairs.
func TestIfaceConfig(t *testing.T) {
var (
Expand Down
1 change: 1 addition & 0 deletions internal/datapath/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (o *Objects) AttachAndPinARP(iface Iface) error {
Attach: ebpf.AttachTCXIngress,
})
if err != nil {
return fmt.Errorf("attach: %w", err)
}

// pin because cni is short-lived
Expand Down
4 changes: 2 additions & 2 deletions internal/image/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ func UnpackDir(img ociv1.Image, path string) ([]File, error) {
dir = filepath.Dir(abs)
// remove all files under p
rmAll = func(m map[string]File, p string) {
for k := range final {
for k := range m {
if !strings.HasPrefix(k, p) {
continue
}
delete(final, k)
delete(m, k)
}
}
)
Expand Down
6 changes: 5 additions & 1 deletion internal/platformd/workload/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ type criService struct {
imgClient runtimev1.ImageServiceClient
}

func NewService(logger *slog.Logger, rtClient runtimev1.RuntimeServiceClient, imgClient runtimev1.ImageServiceClient) Service {
func NewService(
logger *slog.Logger,
rtClient runtimev1.RuntimeServiceClient,
imgClient runtimev1.ImageServiceClient,
) Service {
return &criService{
logger: logger,
rtClient: rtClient,
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/ptpnat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func TestPTPNAT(t *testing.T) {
resp, err := http.Get("http://" + testEnv.Servers[0].PublicNet.IPv4.IP.String() + ":80")
require.NoError(t, err)

defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
t.Errorf("got %d, want %d", resp.StatusCode, http.StatusOK)
}
Expand All @@ -76,7 +78,7 @@ func setup(t *testing.T, ctx context.Context, env *test.Env, addr string) {

defer scpClient.Close()

err = fs.WalkDir(nodedev.Files, ".", func(path string, d fs.DirEntry, err error) error {
err = fs.WalkDir(nodedev.Files, ".", func(path string, d fs.DirEntry, _ error) error {
if d.IsDir() {
return nil
}
Expand Down

0 comments on commit 814ec66

Please sign in to comment.