Skip to content

Commit

Permalink
chore: run make fmt.
Browse files Browse the repository at this point in the history
Also, added the `-s` flag to `addlicense` call in `fmt` make target
to enforce the include of SPDX identifier in license header.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP committed Nov 6, 2023
1 parent 4f06684 commit fceb81a
Show file tree
Hide file tree
Showing 25 changed files with 344 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fmt: gci addlicense
go mod tidy
go fmt ./...
find . -type f -name '*.go' -a -exec $(GCI) write -s standard -s default -s "prefix(github.com/falcosecurity/falcoctl)" {} \;
find . -type f -name '*.go' -exec $(ADDLICENSE) -l apache -c "The Falco Authors" -y "$(shell date +%Y)" {} \;
find . -type f -name '*.go' -exec $(ADDLICENSE) -l apache -s -c "The Falco Authors" -y "$(shell date +%Y)" {} \;

# Install golangci-lint if not available
.PHONY: golangci-lint
Expand Down
18 changes: 17 additions & 1 deletion cmd/driver/driver_linux.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux

package driver

import (
"context"

"github.com/spf13/cobra"

driverprepare "github.com/falcosecurity/falcoctl/cmd/driver/prepare"
driverselect "github.com/falcosecurity/falcoctl/cmd/driver/select"
"github.com/falcosecurity/falcoctl/internal/config"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
"github.com/spf13/cobra"
)

// NewDriverCmd returns the driver command.
Expand Down
18 changes: 17 additions & 1 deletion cmd/driver/driver_others.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !linux

package driver

import (
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
"github.com/spf13/cobra"
"golang.org/x/net/context"

commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)

// NewDriverCmd returns an empty driver command since it is not supported on non linuxes
Expand Down
20 changes: 18 additions & 2 deletions cmd/driver/prepare/prepare.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverprepare

import (
"errors"
"fmt"

"github.com/spf13/cobra"
"golang.org/x/net/context"

"github.com/falcosecurity/falcoctl/internal/config"
driverdistro "github.com/falcosecurity/falcoctl/pkg/driver/distro"
driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

// DriverPrepareOptions contains the options for the driver prepare command.
Expand Down
20 changes: 18 additions & 2 deletions cmd/driver/select/select.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverselect

import (
"fmt"

"github.com/spf13/cobra"
"golang.org/x/net/context"

"github.com/falcosecurity/falcoctl/internal/config"
driverdistro "github.com/falcosecurity/falcoctl/pkg/driver/distro"
driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

// DriverPrepareOptions contains the options for the driver prepare command.
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package cmd

import (
"context"
"github.com/falcosecurity/falcoctl/cmd/driver"

"github.com/spf13/cobra"

"github.com/falcosecurity/falcoctl/cmd/artifact"
"github.com/falcosecurity/falcoctl/cmd/driver"
"github.com/falcosecurity/falcoctl/cmd/index"
"github.com/falcosecurity/falcoctl/cmd/registry"
"github.com/falcosecurity/falcoctl/cmd/tls"
Expand Down
8 changes: 4 additions & 4 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)

var usage_linux = `
var usageLinux = `
__ _ _ _
/ _| __ _| | ___ ___ ___| |_| |
| |_ / _ | |/ __/ _ \ / __| __| |
Expand Down Expand Up @@ -60,7 +60,7 @@ Flags:
Use "falcoctl [command] --help" for more information about a command.
`

var usage_others = `
var usageOthers = `
__ _ _ _
/ _| __ _| | ___ ___ ___| |_| |
| |_ / _ | |/ __/ _ \ / __| __| |
Expand Down Expand Up @@ -93,9 +93,9 @@ Use "falcoctl [command] --help" for more information about a command.

func getUsage() string {
if runtime.GOOS == "linux" {
return usage_linux
return usageLinux
}
return usage_others
return usageOthers
}

var _ = Describe("Root", func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package config
import (
"errors"
"fmt"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"os"
"path/filepath"
"reflect"
Expand All @@ -31,6 +30,7 @@ import (
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"

drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/oci"
)

Expand Down
18 changes: 17 additions & 1 deletion pkg/driver/distro/amzn.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
"fmt"

"github.com/falcosecurity/falcoctl/pkg/output"
"gopkg.in/ini.v1"

"github.com/falcosecurity/falcoctl/pkg/output"
)

func init() {
Expand Down
18 changes: 17 additions & 1 deletion pkg/driver/distro/bottlerocket.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
"fmt"
"strings"

"gopkg.in/ini.v1"

driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
"github.com/falcosecurity/falcoctl/pkg/output"
"gopkg.in/ini.v1"
)

func init() {
Expand Down
15 changes: 15 additions & 0 deletions pkg/driver/distro/centos.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import "os"
Expand Down
15 changes: 15 additions & 0 deletions pkg/driver/distro/debian.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
Expand Down
18 changes: 17 additions & 1 deletion pkg/driver/distro/distro.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
"fmt"
"strings"

"gopkg.in/ini.v1"

driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
"gopkg.in/ini.v1"
)

var distros = map[string]Distro{}
Expand Down
18 changes: 17 additions & 1 deletion pkg/driver/distro/flatcar.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
"fmt"

"gopkg.in/ini.v1"

driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
"github.com/falcosecurity/falcoctl/pkg/output"
"gopkg.in/ini.v1"
)

func init() {
Expand Down
18 changes: 17 additions & 1 deletion pkg/driver/distro/generic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package driverdistro

import (
Expand All @@ -7,11 +22,12 @@ import (
"os"

"github.com/docker/docker/pkg/homedir"
"gopkg.in/ini.v1"

driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
"gopkg.in/ini.v1"
)

type generic struct {
Expand Down

0 comments on commit fceb81a

Please sign in to comment.