From b5969a9bdd1769ae7dc56682c4dbb8bc8f2ab7c3 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 14 Jul 2021 17:01:48 +0000 Subject: all: remove pointers to pkg.build.Params The struct pkg.build.Params is currently primarily passed on as a pointer, which leads make it hard to see the places, where it can (and should) actually be modified. Make it all more explicit by only passing pointer references to objects of this type when the object is expected to be modified by the function. In fact, at this moment there are no such situations. --- pkg/build/linux.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pkg/build/linux.go') diff --git a/pkg/build/linux.go b/pkg/build/linux.go index be2341311..7aedaef16 100644 --- a/pkg/build/linux.go +++ b/pkg/build/linux.go @@ -26,7 +26,7 @@ type linux struct{} var _ signer = linux{} -func (linux linux) build(params *Params) error { +func (linux linux) build(params Params) error { if err := linux.buildKernel(params); err != nil { return err } @@ -47,11 +47,11 @@ func (linux linux) build(params *Params) error { return embedLinuxKernel(params, kernelPath) } -func (linux linux) sign(params *Params) (string, error) { +func (linux linux) sign(params Params) (string, error) { return elfBinarySignature(filepath.Join(params.OutputDir, "obj", "vmlinux")) } -func (linux linux) buildKernel(params *Params) error { +func (linux linux) buildKernel(params Params) error { configFile := filepath.Join(params.KernelDir, ".config") if err := linux.writeFile(configFile, params.Config); err != nil { return fmt.Errorf("failed to write config file: %v", err) @@ -96,7 +96,7 @@ func (linux linux) buildKernel(params *Params) error { return nil } -func (linux) createImage(params *Params, kernelPath string) error { +func (linux) createImage(params Params, kernelPath string) error { tempDir, err := ioutil.TempDir("", "syz-build") if err != nil { return err @@ -162,7 +162,7 @@ func runMakeImpl(arch, compiler, ccache, kernelDir string, addArgs ...string) er return err } -func runMake(params *Params, addArgs ...string) error { +func runMake(params Params, addArgs ...string) error { return runMakeImpl(params.TargetArch, params.Compiler, params.Ccache, params.KernelDir, addArgs...) } -- cgit mrf-deployment