diff --git a/Dockerfile b/Dockerfile index 141872de..811df632 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2022-07-28T09:46:13Z by kres da26917-dirty. +# Generated on 2022-08-03T12:13:32Z by kres 6cf4e14-dirty. ARG TOOLCHAIN @@ -32,7 +32,8 @@ ENV GO111MODULE on ENV CGO_ENABLED 0 ENV GOPATH /go ARG GOLANGCILINT_VERSION -RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b /bin ${GOLANGCILINT_VERSION} +RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \ + && mv /go/bin/golangci-lint /bin/golangci-lint ARG GOFUMPT_VERSION RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ && mv /go/bin/gofumpt /bin/gofumpt diff --git a/Makefile b/Makefile index bc619639..d074ed9e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2022-08-01T14:11:49Z by kres 830b4a2. +# Generated on 2022-08-02T18:28:24Z by kres db471a1-dirty. # common variables @@ -13,7 +13,7 @@ USERNAME ?= siderolabs REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME) GOLANGCILINT_VERSION ?= v1.47.3 GOFUMPT_VERSION ?= v0.3.1 -GO_VERSION ?= 1.18 +GO_VERSION ?= 1.19 GOIMPORTS_VERSION ?= v0.1.11 PROTOBUF_GO_VERSION ?= 1.28.0 GRPC_GO_VERSION ?= 1.2.0 @@ -49,7 +49,7 @@ COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION=$(GRPC_GATEWAY_VERSION) COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION=$(VTPROTOBUF_VERSION) COMMON_ARGS += --build-arg=DEEPCOPY_VERSION=$(DEEPCOPY_VERSION) COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS) -TOOLCHAIN ?= docker.io/golang:1.18-alpine +TOOLCHAIN ?= docker.io/golang:1.19-alpine # help menu diff --git a/cmd/kres/cmd/gen.go b/cmd/kres/cmd/gen.go index 1d3b86de..93317fea 100644 --- a/cmd/kres/cmd/gen.go +++ b/cmd/kres/cmd/gen.go @@ -65,7 +65,7 @@ func runGen() error { var err error options := meta.Options{ - GoContainerVersion: "1.18-alpine", + GoContainerVersion: "1.19-alpine", } options.Config, err = config.NewProvider(".kres.yaml") diff --git a/go.mod b/go.mod index 00fdff9a..34128af5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/talos-systems/kres -go 1.18 +go 1.19 require ( github.com/SOF3/go-stable-toposort v0.0.0-20180826141444-ba650b7de8a0 diff --git a/internal/dag/dag.go b/internal/dag/dag.go index 4624778d..ea9540ee 100644 --- a/internal/dag/dag.go +++ b/internal/dag/dag.go @@ -62,6 +62,7 @@ func walk(targets []Node, walkFn WalkFunc, visited map[Node]struct{}, depth int) } // FindByName walks the nodes to find the node with matching name. +// //nolint:nonamedreturns func FindByName(name string, targets ...Node) (result Node) { visited := make(map[Node]struct{}) diff --git a/internal/project/auto/golang.go b/internal/project/auto/golang.go index 439c29f3..459008b5 100644 --- a/internal/project/auto/golang.go +++ b/internal/project/auto/golang.go @@ -5,7 +5,7 @@ package auto import ( - "io/ioutil" + "io" "os" "path" "path/filepath" @@ -35,7 +35,7 @@ func (builder *builder) DetectGolang() (bool, error) { defer gomod.Close() //nolint:errcheck - contents, err := ioutil.ReadAll(gomod) + contents, err := io.ReadAll(gomod) if err != nil { return true, err } @@ -63,7 +63,7 @@ func (builder *builder) DetectGolang() (bool, error) { if len(builder.meta.GoDirectories) == 0 { // no standard directories found, assume any directory with `.go` files is a source directory - topLevel, err := ioutil.ReadDir(builder.rootPath) + topLevel, err := os.ReadDir(builder.rootPath) if err != nil { return true, err } @@ -117,7 +117,7 @@ func (builder *builder) DetectGolang() (bool, error) { } if cmdExists { - dirs, err := ioutil.ReadDir(filepath.Join(builder.rootPath, "cmd")) + dirs, err := os.ReadDir(filepath.Join(builder.rootPath, "cmd")) if err != nil { return true, err } diff --git a/internal/project/auto/utils.go b/internal/project/auto/utils.go index e9a47596..4732d339 100644 --- a/internal/project/auto/utils.go +++ b/internal/project/auto/utils.go @@ -5,14 +5,13 @@ package auto import ( - "io/ioutil" "os" "path/filepath" "strings" ) func listFilesWithSuffix(path, suffix string) ([]string, error) { - contents, err := ioutil.ReadDir(path) + contents, err := os.ReadDir(path) if err != nil { return nil, err } diff --git a/internal/project/custom/custom.go b/internal/project/custom/custom.go index 1fc7ec9d..4eb1498a 100644 --- a/internal/project/custom/custom.go +++ b/internal/project/custom/custom.go @@ -15,6 +15,7 @@ import ( ) // Step is defined in the config manually. +// //nolint:govet type Step struct { dag.BaseNode diff --git a/internal/project/golang/generate.go b/internal/project/golang/generate.go index 74db2ca8..4e1d80da 100644 --- a/internal/project/golang/generate.go +++ b/internal/project/golang/generate.go @@ -129,6 +129,7 @@ func (generate *Generate) ToolchainBuild(stage *dockerfile.Stage) error { } // CompileDockerfile implements dockerfile.Compiler. +// //nolint:gocognit,gocyclo,cyclop func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error { generateStage := output.Stage("generate"). diff --git a/internal/project/golang/gofumpt.go b/internal/project/golang/gofumpt.go index a4f09cf3..12d5c4be 100644 --- a/internal/project/golang/gofumpt.go +++ b/internal/project/golang/gofumpt.go @@ -33,7 +33,7 @@ func NewGofumpt(meta *meta.Options) *Gofumpt { meta: meta, - GoVersion: "1.18", + GoVersion: "1.19", Version: "v0.3.1", } } diff --git a/internal/project/golang/golangcilint.go b/internal/project/golang/golangcilint.go index a1f8854d..bb3afcc8 100644 --- a/internal/project/golang/golangcilint.go +++ b/internal/project/golang/golangcilint.go @@ -63,7 +63,9 @@ func (lint *GolangciLint) ToolchainBuild(stage *dockerfile.Stage) error { stage. Step(step.Arg("GOLANGCILINT_VERSION")). Step(step.Script( - fmt.Sprintf("curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b %s ${GOLANGCILINT_VERSION}", lint.meta.BinPath), + fmt.Sprintf( + "go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \\\n"+ + "\t&& mv /go/bin/golangci-lint %s/golangci-lint", lint.meta.BinPath), )) return nil diff --git a/internal/project/js/templates/templates.go b/internal/project/js/templates/templates.go index e39c1daa..5dff5f25 100644 --- a/internal/project/js/templates/templates.go +++ b/internal/project/js/templates/templates.go @@ -10,18 +10,22 @@ import ( ) // Babel babel.config.js. +// //go:embed babel.js var Babel string // Eslint eslintrc.yaml. +// //go:embed eslint.yaml var Eslint string // Jest jest.config.js. +// //go:embed jest.js var Jest string // TSConfig tsconfig.json. +// //go:embed tsconfig.json var TSConfig string