fix from lint error

This commit is contained in:
yugo kobayashi
2022-07-07 20:35:27 +00:00
parent 17af5d518f
commit 396b693e1c
3 changed files with 7 additions and 4 deletions

View File

@@ -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)

View File

@@ -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 ./

View File

@@ -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 {