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

Commit 8110381

Browse files
author
Eoghan Russell
authored
Fix Go fmt issues (#172)
Signed-off-by: Eoghan Russell <[email protected]>
1 parent 75f2163 commit 8110381

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

Diff for: cniovs/cniovs_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ func TestDelLocalDeviceVhost(t *testing.T) {
657657
// cleanup if needed
658658
defer os.RemoveAll(tc.sharedDir)
659659
defer os.RemoveAll(sharedDir)
660-
defer func () {
660+
defer func() {
661661
_ = unix.Unmount(sharedDir, 0)
662662
}()
663663
} else {

Diff for: cniovs/localdb.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ type OvsSavedData struct {
5353
//
5454

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

5960
// Current implementation is to write data to a file with the name:

Diff for: cnivpp/api/infra/infra.go

-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@ import (
2929
"go.fd.io/govpp/core"
3030
)
3131

32-
//
3332
// Constants
34-
//
3533
const debugInfra = false
3634

37-
//
3835
// Types
39-
//
4036
type ConnectionData struct {
4137
conn *core.Connection
4238
disconnectFlag bool

Diff for: logging/logging.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ type Level uint32
2929
// Common use of different level:
3030
// "panic": Code crash.
3131
// "error": Unusual event occurred (invalid input or system issue),
32-
// so exiting code prematurely.
32+
//
33+
// so exiting code prematurely.
34+
//
3335
// "warning": Unusual event occurred (invalid input or system issue),
34-
// but continuing.
36+
//
37+
// but continuing.
38+
//
3539
// "info": Basic information, indication of major code paths.
3640
// "debug": Additional information, indication of minor code branches.
3741
// "verbose": Output of larger variables in code and debug of low level
38-
// functions.
42+
//
43+
// functions.
3944
const (
4045
PanicLevel Level = iota
4146
ErrorLevel

Diff for: pkg/annotations/annotations.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import (
1313
"bytes"
1414
"encoding/json"
1515
"fmt"
16-
"path/filepath"
17-
"strings"
18-
"os"
1916
v1 "k8s.io/api/core/v1"
2017
"k8s.io/client-go/kubernetes"
18+
"os"
19+
"path/filepath"
20+
"strings"
2121

2222
"github.com/go-logfmt/logfmt"
2323

Diff for: pkg/configdata/configdata.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ import (
3333
"github.com/containernetworking/cni/pkg/skel"
3434
current "github.com/containernetworking/cni/pkg/types/100"
3535

36+
"github.com/intel/userspace-cni-network-plugin/logging"
3637
"github.com/intel/userspace-cni-network-plugin/pkg/annotations"
3738
"github.com/intel/userspace-cni-network-plugin/pkg/types"
38-
"github.com/intel/userspace-cni-network-plugin/logging"
3939
)
4040

4141
//
@@ -49,7 +49,6 @@ const DefaultVppCNIDir = "/var/run/vpp"
4949
// Types
5050
//
5151

52-
5352
//
5453
// API Functions
5554
//
@@ -59,15 +58,16 @@ const DefaultVppCNIDir = "/var/run/vpp"
5958
//
6059

6160
// saveRemoteConfig() - When a config read on the host is for a Container,
62-
// flip the location and write the data to a file. When the Container
63-
// comes up, it will read the file via () and delete the file. This function
64-
// writes the file.
61+
//
62+
// flip the location and write the data to a file. When the Container
63+
// comes up, it will read the file via () and delete the file. This function
64+
// writes the file.
6565
func SaveRemoteConfig(conf *types.NetConf,
66-
args *skel.CmdArgs,
67-
kubeClient kubernetes.Interface,
68-
sharedDir string,
69-
pod *v1.Pod,
70-
ipResult *current.Result) (*v1.Pod, error) {
66+
args *skel.CmdArgs,
67+
kubeClient kubernetes.Interface,
68+
sharedDir string,
69+
pod *v1.Pod,
70+
ipResult *current.Result) (*v1.Pod, error) {
7171
var configData types.ConfigurationData
7272
var err error
7373

@@ -168,8 +168,9 @@ func SaveRemoteConfig(conf *types.NetConf,
168168
}
169169

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

186187
// This function deletes the input file (if provided) and the associated
187188
// directory (if provided) if the directory is empty.
188-
// directory string - Directory file is located in, Use "" if directory
189-
// should remain unchanged.
190-
// filepath string - File (including directory) to be deleted. Use "" if
191-
// only the directory should be deleted.
189+
//
190+
// directory string - Directory file is located in, Use "" if directory
191+
// should remain unchanged.
192+
// filepath string - File (including directory) to be deleted. Use "" if
193+
// only the directory should be deleted.
192194
func FileCleanup(directory string, filepath string) (err error) {
193195

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

217-
218219
type InterfaceData struct {
219-
Args skel.CmdArgs
220-
NetConf types.NetConf
221-
IPResult current.Result
220+
Args skel.CmdArgs
221+
NetConf types.NetConf
222+
IPResult current.Result
222223
}
223224

224225
func GetRemoteConfig(annotFile string) ([]*InterfaceData, string, error) {
@@ -258,6 +259,5 @@ func GetRemoteConfig(annotFile string) ([]*InterfaceData, string, error) {
258259
ifaceList = append(ifaceList, &ifaceData)
259260
}
260261

261-
262262
return ifaceList, mappedDir, err
263263
}

Diff for: pkg/configdata/configdata_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestSaveRemoteConfig(t *testing.T) {
144144
testType: "client_nil",
145145
brokenDir: "none",
146146
expJson: `{"containerId":"#UUID#","ifName":"#ifName#","name":"","config":{"iftype":"vhostuser","memif":{},"vhost":{"mode":"server"},"bridge":{}},"ipResult":{"dns":{}}}`,
147-
expErr: nil,
147+
expErr: nil,
148148
},
149149
{
150150
name: "fail to save file to broken dir",

Diff for: usrspcni/usrspcni.go

-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import (
2424
"github.com/intel/userspace-cni-network-plugin/pkg/types"
2525
)
2626

27-
//
2827
// Exported Types
29-
//
3028
type UsrSpCni interface {
3129
AddOnHost(conf *types.NetConf,
3230
args *skel.CmdArgs,

0 commit comments

Comments
 (0)