]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
Remove superfluous struct names
authorSimon Ruderich <simon@ruderich.org>
Thu, 23 Dec 2021 17:07:50 +0000 (18:07 +0100)
committerSimon Ruderich <simon@ruderich.org>
Thu, 23 Dec 2021 17:13:27 +0000 (18:13 +0100)
Found by golangci-lint's gofmt linter

cmd/safcm/sync_sync_test.go
remote/ainsl/ainsl_test.go
remote/sync/packages_debian_test.go
remote/sync/services_systemd_test.go

index 40c5c556eccd5961513abe52c4671ed467a6b7db..cfa47fac38e9b50294a1e1d7a3675fd91ccfd6d1 100644 (file)
@@ -62,7 +62,7 @@ func TestHostSyncReq(t *testing.T) {
                                        "host1.example.org",
                                },
                                Files: map[string]*safcm.File{
-                                       "/": &safcm.File{Path: "/",
+                                       "/": {Path: "/",
                                                OrigGroup: "group",
                                                Mode:      fs.ModeDir | 0755 | fs.ModeSetgid,
                                                Uid:       -1,
@@ -71,14 +71,14 @@ func TestHostSyncReq(t *testing.T) {
                                                        "touch /.update",
                                                },
                                        },
-                                       "/etc": &safcm.File{
+                                       "/etc": {
                                                OrigGroup: "group",
                                                Path:      "/etc",
                                                Mode:      fs.ModeDir | 0755,
                                                Uid:       -1,
                                                Gid:       -1,
                                        },
-                                       "/etc/.hidden": &safcm.File{
+                                       "/etc/.hidden": {
                                                OrigGroup: "group",
                                                Path:      "/etc/.hidden",
                                                Mode:      0100 | fs.ModeSetuid | fs.ModeSetgid | fs.ModeSticky,
@@ -86,7 +86,7 @@ func TestHostSyncReq(t *testing.T) {
                                                Gid:       -1,
                                                Data:      []byte("..."),
                                        },
-                                       "/etc/motd": &safcm.File{
+                                       "/etc/motd": {
                                                OrigGroup: "group",
                                                Path:      "/etc/motd",
                                                Mode:      0644,
@@ -94,7 +94,7 @@ func TestHostSyncReq(t *testing.T) {
                                                Gid:       -1,
                                                Data:      []byte("Welcome to Host ONE\n\n\n\n\n\nall\n\n\nhost1.example.org\n\n\n\n"),
                                        },
-                                       "/etc/rc.local": &safcm.File{
+                                       "/etc/rc.local": {
                                                OrigGroup: "group",
                                                Path:      "/etc/rc.local",
                                                Mode:      0700,
@@ -105,7 +105,7 @@ func TestHostSyncReq(t *testing.T) {
                                                        "/etc/rc.local",
                                                },
                                        },
-                                       "/etc/resolv.conf": &safcm.File{
+                                       "/etc/resolv.conf": {
                                                OrigGroup: "group",
                                                Path:      "/etc/resolv.conf",
                                                Mode:      0641,
@@ -118,7 +118,7 @@ func TestHostSyncReq(t *testing.T) {
                                                        "echo resolv.conf updated",
                                                },
                                        },
-                                       "/etc/test": &safcm.File{
+                                       "/etc/test": {
                                                OrigGroup: "group",
                                                Path:      "/etc/test",
                                                Mode:      os.ModeSymlink | 0777,
index ed52bb0f758f4981948e4ff9fbf5b6918f1bee8c..07d92420b59a076e19c8022a690577a299971a26 100644 (file)
@@ -94,7 +94,7 @@ func TestHandle(t *testing.T) {
                        nil,
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0640,
                                        Data: []byte("line\n"),
@@ -141,7 +141,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("line\n"),
@@ -161,7 +161,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("existing\nline\n"),
@@ -182,7 +182,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("existing\nline\n"),
@@ -204,7 +204,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("first\nline\n"),
@@ -225,7 +225,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("first\nline\n"),
@@ -246,7 +246,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: 0641,
                                        Data: []byte("# line with spaces\nline with spaces\n"),
@@ -268,7 +268,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: fs.ModeSymlink | 0777,
                                        Data: []byte("target"),
@@ -287,7 +287,7 @@ func TestHandle(t *testing.T) {
                        },
                        []ft.File{
                                root,
-                               ft.File{
+                               {
                                        Path: "file",
                                        Mode: fs.ModeNamedPipe | 0640,
                                },
index 97b8c6182d3f6a9727c05a680bb034ddabb04fff..c34819007c6192bcde0cf96be3b1d2447b445436 100644 (file)
@@ -62,7 +62,7 @@ install ok installed  package-two
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/usr/bin/dpkg-query",
                                Args: []string{
                                        "/usr/bin/dpkg-query",
@@ -110,7 +110,7 @@ install ok installed        package-two
                        },
                        [][]byte{nil, nil},
                        []error{nil, nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/usr/bin/dpkg-query",
                                Args: []string{
                                        "/usr/bin/dpkg-query",
@@ -119,7 +119,7 @@ install ok installed        package-two
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/usr/bin/apt-get",
                                Args: []string{
                                        "/usr/bin/apt-get",
@@ -186,7 +186,7 @@ install ok installed        golang-1.16-src
                                nil,
                                fmt.Errorf("fake error"),
                        },
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/usr/bin/dpkg-query",
                                Args: []string{
                                        "/usr/bin/dpkg-query",
@@ -195,7 +195,7 @@ install ok installed        golang-1.16-src
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/usr/bin/apt-get",
                                Args: []string{
                                        "/usr/bin/apt-get",
@@ -258,7 +258,7 @@ install ok installed        golang-1.16-src
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/usr/bin/dpkg-query",
                                Args: []string{
                                        "/usr/bin/dpkg-query",
index 5aa36cd7bc38019eac8d947d374876cf05bf4f7b..b6b45dd7b64ca2dbb9299ba525f449acb102dd8a 100644 (file)
@@ -61,7 +61,7 @@ LoadError=
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -111,7 +111,7 @@ LoadError= ""
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -161,7 +161,7 @@ LoadError=
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -224,7 +224,7 @@ LoadError=
                                []byte("fake stderr"),
                        },
                        []error{nil, nil, nil, nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -237,7 +237,7 @@ LoadError=
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -245,7 +245,7 @@ LoadError=
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -256,7 +256,7 @@ LoadError=
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -337,7 +337,7 @@ LoadError=
                        },
                        [][]byte{nil},
                        []error{nil},
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -423,7 +423,7 @@ LoadError=
                                nil,
                                fmt.Errorf("fake error"),
                        },
-                       []*exec.Cmd{&exec.Cmd{
+                       []*exec.Cmd{{
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -436,7 +436,7 @@ LoadError=
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",
@@ -444,7 +444,7 @@ LoadError=
                                },
                                Stdout: &bytes.Buffer{},
                                Stderr: &bytes.Buffer{},
-                       }, &exec.Cmd{
+                       }, {
                                Path: "/bin/systemctl",
                                Args: []string{
                                        "/bin/systemctl",