From: Simon Ruderich Date: Thu, 23 Dec 2021 17:07:50 +0000 (+0100) Subject: Remove superfluous struct names X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=8620dac1f9ee7f73058e3e97b488ec0c710a89df;p=safcm%2Fsafcm.git Remove superfluous struct names Found by golangci-lint's gofmt linter --- diff --git a/cmd/safcm/sync_sync_test.go b/cmd/safcm/sync_sync_test.go index 40c5c55..cfa47fa 100644 --- a/cmd/safcm/sync_sync_test.go +++ b/cmd/safcm/sync_sync_test.go @@ -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, diff --git a/remote/ainsl/ainsl_test.go b/remote/ainsl/ainsl_test.go index ed52bb0..07d9242 100644 --- a/remote/ainsl/ainsl_test.go +++ b/remote/ainsl/ainsl_test.go @@ -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, }, diff --git a/remote/sync/packages_debian_test.go b/remote/sync/packages_debian_test.go index 97b8c61..c348190 100644 --- a/remote/sync/packages_debian_test.go +++ b/remote/sync/packages_debian_test.go @@ -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", diff --git a/remote/sync/services_systemd_test.go b/remote/sync/services_systemd_test.go index 5aa36cd..b6b45dd 100644 --- a/remote/sync/services_systemd_test.go +++ b/remote/sync/services_systemd_test.go @@ -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",