Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Fix Go fmt issues #172

Merged
merged 1 commit into from
Sep 15, 2023
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
2 changes: 1 addition & 1 deletion cniovs/cniovs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func TestDelLocalDeviceVhost(t *testing.T) {
// cleanup if needed
defer os.RemoveAll(tc.sharedDir)
defer os.RemoveAll(sharedDir)
defer func () {
defer func() {
_ = unix.Unmount(sharedDir, 0)
}()
} else {
Expand Down
3 changes: 2 additions & 1 deletion cniovs/localdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ type OvsSavedData struct {
//

// SaveConfig() - Some data needs to be saved for cmdDel().
// This function squirrels the data away to be retrieved later.
//
// This function squirrels the data away to be retrieved later.
func SaveConfig(conf *types.NetConf, args *skel.CmdArgs, data *OvsSavedData) error {

// Current implementation is to write data to a file with the name:
Expand Down
4 changes: 0 additions & 4 deletions cnivpp/api/infra/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ import (
"go.fd.io/govpp/core"
)

//
// Constants
//
const debugInfra = false

//
// Types
//
type ConnectionData struct {
conn *core.Connection
disconnectFlag bool
Expand Down
11 changes: 8 additions & 3 deletions logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ type Level uint32
// Common use of different level:
// "panic": Code crash.
// "error": Unusual event occurred (invalid input or system issue),
// so exiting code prematurely.
//
// so exiting code prematurely.
//
// "warning": Unusual event occurred (invalid input or system issue),
// but continuing.
//
// but continuing.
//
// "info": Basic information, indication of major code paths.
// "debug": Additional information, indication of minor code branches.
// "verbose": Output of larger variables in code and debug of low level
// functions.
//
// functions.
const (
PanicLevel Level = iota
ErrorLevel
Expand Down
6 changes: 3 additions & 3 deletions pkg/annotations/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"bytes"
"encoding/json"
"fmt"
"path/filepath"
"strings"
"os"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"os"
"path/filepath"
"strings"

"github.com/go-logfmt/logfmt"

Expand Down
42 changes: 21 additions & 21 deletions pkg/configdata/configdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import (
"github.com/containernetworking/cni/pkg/skel"
current "github.com/containernetworking/cni/pkg/types/100"

"github.com/intel/userspace-cni-network-plugin/logging"
"github.com/intel/userspace-cni-network-plugin/pkg/annotations"
"github.com/intel/userspace-cni-network-plugin/pkg/types"
"github.com/intel/userspace-cni-network-plugin/logging"
)

//
Expand All @@ -49,7 +49,6 @@ const DefaultVppCNIDir = "/var/run/vpp"
// Types
//


//
// API Functions
//
Expand All @@ -59,15 +58,16 @@ const DefaultVppCNIDir = "/var/run/vpp"
//

// saveRemoteConfig() - When a config read on the host is for a Container,
// flip the location and write the data to a file. When the Container
// comes up, it will read the file via () and delete the file. This function
// writes the file.
//
// flip the location and write the data to a file. When the Container
// comes up, it will read the file via () and delete the file. This function
// writes the file.
func SaveRemoteConfig(conf *types.NetConf,
args *skel.CmdArgs,
kubeClient kubernetes.Interface,
sharedDir string,
pod *v1.Pod,
ipResult *current.Result) (*v1.Pod, error) {
args *skel.CmdArgs,
kubeClient kubernetes.Interface,
sharedDir string,
pod *v1.Pod,
ipResult *current.Result) (*v1.Pod, error) {
var configData types.ConfigurationData
var err error

Expand Down Expand Up @@ -168,8 +168,9 @@ func SaveRemoteConfig(conf *types.NetConf,
}

// CleanupRemoteConfig() - This function cleans up any remaining files
// in the passed in directory. Some of these files were used to squirrel
// data from the create so interface can be deleted properly.
//
// in the passed in directory. Some of these files were used to squirrel
// data from the create so interface can be deleted properly.
//
// FIXME: parameter *conf* is not used. It shall be used or removed.
func CleanupRemoteConfig(conf *types.NetConf, sharedDir string) {
Expand All @@ -185,10 +186,11 @@ func CleanupRemoteConfig(conf *types.NetConf, sharedDir string) {

// This function deletes the input file (if provided) and the associated
// directory (if provided) if the directory is empty.
// directory string - Directory file is located in, Use "" if directory
// should remain unchanged.
// filepath string - File (including directory) to be deleted. Use "" if
// only the directory should be deleted.
//
// directory string - Directory file is located in, Use "" if directory
// should remain unchanged.
// filepath string - File (including directory) to be deleted. Use "" if
// only the directory should be deleted.
func FileCleanup(directory string, filepath string) (err error) {

// If File is provided, delete it.
Expand All @@ -214,11 +216,10 @@ func FileCleanup(directory string, filepath string) (err error) {
return
}


type InterfaceData struct {
Args skel.CmdArgs
NetConf types.NetConf
IPResult current.Result
Args skel.CmdArgs
NetConf types.NetConf
IPResult current.Result
}

func GetRemoteConfig(annotFile string) ([]*InterfaceData, string, error) {
Expand Down Expand Up @@ -258,6 +259,5 @@ func GetRemoteConfig(annotFile string) ([]*InterfaceData, string, error) {
ifaceList = append(ifaceList, &ifaceData)
}


return ifaceList, mappedDir, err
}
2 changes: 1 addition & 1 deletion pkg/configdata/configdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestSaveRemoteConfig(t *testing.T) {
testType: "client_nil",
brokenDir: "none",
expJson: `{"containerId":"#UUID#","ifName":"#ifName#","name":"","config":{"iftype":"vhostuser","memif":{},"vhost":{"mode":"server"},"bridge":{}},"ipResult":{"dns":{}}}`,
expErr: nil,
expErr: nil,
},
{
name: "fail to save file to broken dir",
Expand Down
2 changes: 0 additions & 2 deletions usrspcni/usrspcni.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import (
"github.com/intel/userspace-cni-network-plugin/pkg/types"
)

//
// Exported Types
//
type UsrSpCni interface {
AddOnHost(conf *types.NetConf,
args *skel.CmdArgs,
Expand Down