diff --git a/kyaml/fn/framework/command/command.go b/kyaml/fn/framework/command/command.go index a0fc4cd59..4c7a2b758 100644 --- a/kyaml/fn/framework/command/command.go +++ b/kyaml/fn/framework/command/command.go @@ -122,7 +122,7 @@ func AddGenerateDockerfile(cmd *cobra.Command) { Use: "gen [DIR]", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - return ioutil.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM golang:1.16-alpine as builder + if err := ioutil.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM golang:1.18-alpine as builder ENV CGO_ENABLED=0 WORKDIR /go/src/ COPY go.mod go.sum ./ @@ -133,7 +133,10 @@ RUN go build -ldflags '-w -s' -v -o /usr/local/bin/function ./ FROM alpine:latest COPY --from=builder /usr/local/bin/function /usr/local/bin/function ENTRYPOINT ["function"] -`), 0600) +`), 0600); err != nil { + return fmt.Errorf("%w", err) + } + return nil }, } cmd.AddCommand(gen) diff --git a/kyaml/fn/framework/command/command_test.go b/kyaml/fn/framework/command/command_test.go index 25d846694..523818920 100644 --- a/kyaml/fn/framework/command/command_test.go +++ b/kyaml/fn/framework/command/command_test.go @@ -41,7 +41,7 @@ func TestCommand_dockerfile(t *testing.T) { t.FailNow() } - expected := `FROM golang:1.16-alpine as builder + expected := `FROM golang:1.18-alpine as builder ENV CGO_ENABLED=0 WORKDIR /go/src/ COPY go.mod go.sum ./ diff --git a/kyaml/kio/ignorefilesmatcher_test.go b/kyaml/kio/ignorefilesmatcher_test.go index ccdbe9163..2fc919f14 100644 --- a/kyaml/kio/ignorefilesmatcher_test.go +++ b/kyaml/kio/ignorefilesmatcher_test.go @@ -41,7 +41,7 @@ func TestIgnoreFilesMatcher_readIgnoreFile(t *testing.T) { fsMakers := map[string]func(bool) (string, filesys.FileSystem){ // onDisk creates a temp directory and returns a nil FileSystem, testing // the normal conditions under which ignoreFileMatcher is used. - "onDisk": func(writeIgnoreFile bool) (string, filesys.FileSystem) { //nolint:unparam + "onDisk": func(writeIgnoreFile bool) (string, filesys.FileSystem) { dir := t.TempDir() if writeIgnoreFile {