Skip to content

Commit

Permalink
feat: update Go to 1.19
Browse files Browse the repository at this point in the history
See https://go.dev/doc/go1.19

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Aug 3, 2022
1 parent db471a1 commit 4dc0221
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 15 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions 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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cmd/kres/cmd/gen.go
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
1 change: 1 addition & 0 deletions internal/dag/dag.go
Expand Up @@ -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{})
Expand Down
8 changes: 4 additions & 4 deletions internal/project/auto/golang.go
Expand Up @@ -5,7 +5,7 @@
package auto

import (
"io/ioutil"
"io"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions internal/project/auto/utils.go
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions internal/project/custom/custom.go
Expand Up @@ -15,6 +15,7 @@ import (
)

// Step is defined in the config manually.
//
//nolint:govet
type Step struct {
dag.BaseNode
Expand Down
1 change: 1 addition & 0 deletions internal/project/golang/generate.go
Expand Up @@ -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").
Expand Down
2 changes: 1 addition & 1 deletion internal/project/golang/gofumpt.go
Expand Up @@ -33,7 +33,7 @@ func NewGofumpt(meta *meta.Options) *Gofumpt {

meta: meta,

GoVersion: "1.18",
GoVersion: "1.19",
Version: "v0.3.1",
}
}
Expand Down
4 changes: 3 additions & 1 deletion internal/project/golang/golangcilint.go
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/project/js/templates/templates.go
Expand Up @@ -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

Expand Down

0 comments on commit 4dc0221

Please sign in to comment.