chore: update Go to 1.19, Linux to 5.15.58
See https://go.dev/doc/go1.19 Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
fb058a7c92
commit
a6b010a8b4
@ -95,7 +95,8 @@ RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
|
||||
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/bin/bash", "/bin/sh"]
|
||||
RUN ["/toolchain/bin/ln", "-svf", "/toolchain/etc/ssl", "/etc/ssl"]
|
||||
ARG GOLANGCILINT_VERSION
|
||||
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b /toolchain/bin ${GOLANGCILINT_VERSION}
|
||||
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
|
||||
&& mv /go/bin/golangci-lint /toolchain/go/bin/golangci-lint
|
||||
ARG GOIMPORTS_VERSION
|
||||
RUN --mount=type=cache,target=/.cache go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
|
||||
&& mv /go/bin/goimports /toolchain/go/bin/goimports
|
||||
|
8
Makefile
8
Makefile
@ -13,10 +13,10 @@ DOCKER_LOGIN_ENABLED ?= true
|
||||
NAME = Talos
|
||||
|
||||
ARTIFACTS := _out
|
||||
TOOLS ?= ghcr.io/siderolabs/tools:v1.2.0-alpha.0-4-g0d669dd
|
||||
PKGS ?= v1.2.0-alpha.0-23-gdcc0311
|
||||
EXTRAS ?= v1.2.0-alpha.0-1-g17a319f
|
||||
GO_VERSION ?= 1.18
|
||||
TOOLS ?= ghcr.io/siderolabs/tools:v1.2.0-alpha.0-6-gcd35510
|
||||
PKGS ?= v1.2.0-alpha.0-25-g6feece4
|
||||
EXTRAS ?= v1.2.0-alpha.0-2-gda35a63
|
||||
GO_VERSION ?= 1.19
|
||||
GOIMPORTS_VERSION ?= v0.1.11
|
||||
GOFUMPT_VERSION ?= v0.3.0
|
||||
GOLANGCILINT_VERSION ?= v1.47.2
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -123,7 +122,7 @@ func runISOCmd() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(cfgPath, grubCfg.Bytes(), 0o666); err != nil {
|
||||
if err = os.WriteFile(cfgPath, grubCfg.Bytes(), 0o666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ package install_test
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -51,7 +50,7 @@ func (suite *manifestSuite) SetupTest() {
|
||||
|
||||
var err error
|
||||
|
||||
suite.disk, err = ioutil.TempFile("", "talos")
|
||||
suite.disk, err = os.CreateTemp("", "talos")
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().NoError(suite.disk.Truncate(diskSize))
|
||||
@ -200,8 +199,8 @@ func (suite *manifestSuite) verifyBlockdevice(manifest *install.Manifest, curren
|
||||
|
||||
if next != "" {
|
||||
suite.Assert().NoError(os.MkdirAll(filepath.Join(tempDir, "boot", next), 0o700))
|
||||
suite.Assert().NoError(ioutil.WriteFile(filepath.Join(tempDir, "boot", next, "kernel"), []byte("LINUX!"), 0o660))
|
||||
suite.Assert().NoError(ioutil.WriteFile(filepath.Join(tempDir, "system", "state", "config.yaml"), []byte("#!yaml"), 0o660))
|
||||
suite.Assert().NoError(os.WriteFile(filepath.Join(tempDir, "boot", next, "kernel"), []byte("LINUX!"), 0o660))
|
||||
suite.Assert().NoError(os.WriteFile(filepath.Join(tempDir, "system", "state", "config.yaml"), []byte("#!yaml"), 0o660))
|
||||
|
||||
buf := []byte(next)
|
||||
|
||||
@ -214,7 +213,7 @@ func (suite *manifestSuite) verifyBlockdevice(manifest *install.Manifest, curren
|
||||
suite.Assert().NoError(f.Close())
|
||||
}
|
||||
|
||||
suite.Assert().NoError(ioutil.WriteFile(filepath.Join(tempDir, "var", "content"), []byte("data"), 0o600))
|
||||
suite.Assert().NoError(os.WriteFile(filepath.Join(tempDir, "var", "content"), []byte("data"), 0o600))
|
||||
}
|
||||
|
||||
func (suite *manifestSuite) TestExecuteManifestClean() {
|
||||
@ -324,7 +323,7 @@ func (suite *manifestSuite) TestTargetInstall() {
|
||||
dir := suite.T().TempDir()
|
||||
|
||||
// Create a tempfile for local copy
|
||||
src, err := ioutil.TempFile(dir, "example")
|
||||
src, err := os.CreateTemp(dir, "example")
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().NoError(src.Close())
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -26,6 +25,7 @@ SHA256({{ .OVF }})= {{ .OVFSHA }}
|
||||
`
|
||||
|
||||
// OVF format reference: https://www.dmtf.org/standards/ovf.
|
||||
//
|
||||
//nolint:lll
|
||||
const ovfTpl = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--Generated by VMware ovftool 4.3.0 (build-7948156), UTC time: 2019-10-31T01:41:10.540841Z-->
|
||||
@ -138,9 +138,10 @@ const ovfTpl = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
`
|
||||
|
||||
// CreateOVAFromRAW creates an OVA from a RAW disk.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func CreateOVAFromRAW(name, src, out, arch string) (err error) {
|
||||
dir, err := ioutil.TempDir("/tmp", "talos")
|
||||
dir, err := os.MkdirTemp("/tmp", "talos")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -186,11 +187,11 @@ func CreateOVAFromRAW(name, src, out, arch string) (err error) {
|
||||
//nolint:errcheck
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
if err = ioutil.WriteFile(filepath.Join(dir, name+".mf"), []byte(mf), 0o666); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(dir, name+".mf"), []byte(mf), 0o666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(filepath.Join(dir, name+".ovf"), []byte(ovf), 0o666); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(dir, name+".ovf"), []byte(ovf), 0o666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ package gen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -40,15 +40,15 @@ var genCACmd = &cobra.Command{
|
||||
return fmt.Errorf("error generating CA: %w", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(genCACmdFlags.organization+".crt", ca.CrtPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(genCACmdFlags.organization+".crt", ca.CrtPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing CA certificate: %w", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(genCACmdFlags.organization+".sha256", []byte(x509.Hash(ca.Crt)), 0o600); err != nil {
|
||||
if err := os.WriteFile(genCACmdFlags.organization+".sha256", []byte(x509.Hash(ca.Crt)), 0o600); err != nil {
|
||||
return fmt.Errorf("error writing certificate hash: %w", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(genCACmdFlags.organization+".key", ca.KeyPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(genCACmdFlags.organization+".key", ca.KeyPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing key: %w", err)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ package gen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -236,7 +235,7 @@ func writeV1Alpha1Config(args []string) error {
|
||||
|
||||
fullFilePath := filepath.Join(genConfigCmdFlags.outputDir, "talosconfig")
|
||||
|
||||
if err = ioutil.WriteFile(fullFilePath, data, 0o644); err != nil {
|
||||
if err = os.WriteFile(fullFilePath, data, 0o644); err != nil {
|
||||
return fmt.Errorf("%w", err)
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
stdlibx509 "crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@ -31,7 +31,7 @@ var genCrtCmd = &cobra.Command{
|
||||
Long: ``,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
caBytes, err := ioutil.ReadFile(genCrtCmdFlags.ca + ".crt")
|
||||
caBytes, err := os.ReadFile(genCrtCmdFlags.ca + ".crt")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading CA cert: %s", err)
|
||||
}
|
||||
@ -46,7 +46,7 @@ var genCrtCmd = &cobra.Command{
|
||||
return fmt.Errorf("error parsing cert: %s", err)
|
||||
}
|
||||
|
||||
keyBytes, err := ioutil.ReadFile(genCrtCmdFlags.ca + ".key")
|
||||
keyBytes, err := os.ReadFile(genCrtCmdFlags.ca + ".key")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading key file: %s", err)
|
||||
}
|
||||
@ -61,7 +61,7 @@ var genCrtCmd = &cobra.Command{
|
||||
return fmt.Errorf("error parsing EC key: %s", err)
|
||||
}
|
||||
|
||||
csrBytes, err := ioutil.ReadFile(genCrtCmdFlags.csr)
|
||||
csrBytes, err := os.ReadFile(genCrtCmdFlags.csr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading CSR: %s", err)
|
||||
}
|
||||
@ -81,7 +81,7 @@ var genCrtCmd = &cobra.Command{
|
||||
return fmt.Errorf("error signing certificate: %s", err)
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(genCrtCmdFlags.name+".crt", signedCrt.X509CertificatePEM, 0o600); err != nil {
|
||||
if err = os.WriteFile(genCrtCmdFlags.name+".crt", signedCrt.X509CertificatePEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing certificate: %s", err)
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
stdlibx509 "crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@ -33,7 +33,7 @@ var genCSRCmd = &cobra.Command{
|
||||
Long: ``,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
keyBytes, err := ioutil.ReadFile(genCSRCmdFlags.key)
|
||||
keyBytes, err := os.ReadFile(genCSRCmdFlags.key)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading key: %s", err)
|
||||
}
|
||||
@ -69,7 +69,7 @@ var genCSRCmd = &cobra.Command{
|
||||
return fmt.Errorf("error generating CSR: %s", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(strings.TrimSuffix(genCSRCmdFlags.key, path.Ext(genCSRCmdFlags.key))+".csr", csr.X509CertificateRequestPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(strings.TrimSuffix(genCSRCmdFlags.key, path.Ext(genCSRCmdFlags.key))+".csr", csr.X509CertificateRequestPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing CSR: %s", err)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ package gen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/talos-systems/crypto/x509"
|
||||
@ -30,7 +30,7 @@ var genKeyCmd = &cobra.Command{
|
||||
return fmt.Errorf("error generating key: %w", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(genKeyCmdFlags.name+".key", key.PrivateKeyPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(genKeyCmdFlags.name+".key", key.PrivateKeyPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing key: %w", err)
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ package gen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/talos-systems/crypto/x509"
|
||||
@ -43,10 +43,10 @@ var genKeypairCmd = &cobra.Command{
|
||||
if err != nil {
|
||||
return fmt.Errorf("error generating CA: %s", err)
|
||||
}
|
||||
if err := ioutil.WriteFile(genKeypairCmdFlags.organization+".crt", ca.CrtPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(genKeypairCmdFlags.organization+".crt", ca.CrtPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing certificate: %s", err)
|
||||
}
|
||||
if err := ioutil.WriteFile(genKeypairCmdFlags.organization+".key", ca.KeyPEM, 0o600); err != nil {
|
||||
if err := os.WriteFile(genKeypairCmdFlags.organization+".key", ca.KeyPEM, 0o600); err != nil {
|
||||
return fmt.Errorf("error writing key: %s", err)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ package gen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"gopkg.in/yaml.v3"
|
||||
@ -69,7 +69,7 @@ func writeSecretsBundleToFile(bundle *generate.SecretsBundle) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(genSecretsCmdFlags.outputFile, bundleBytes, 0o600)
|
||||
return os.WriteFile(genSecretsCmdFlags.outputFile, bundleBytes, 0o600)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -7,7 +7,7 @@ package talos
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -56,7 +56,7 @@ var applyConfigCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
if applyConfigCmdFlags.filename != "" {
|
||||
cfgBytes, e = ioutil.ReadFile(applyConfigCmdFlags.filename)
|
||||
cfgBytes, e = os.ReadFile(applyConfigCmdFlags.filename)
|
||||
if e != nil {
|
||||
return fmt.Errorf("failed to read configuration from %q: %w", applyConfigCmdFlags.filename, e)
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@ -158,17 +157,17 @@ var configAddCmd = &cobra.Command{
|
||||
return fmt.Errorf("error reading config: %w", err)
|
||||
}
|
||||
|
||||
caBytes, err := ioutil.ReadFile(configAddCmdFlags.ca)
|
||||
caBytes, err := os.ReadFile(configAddCmdFlags.ca)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading CA: %w", err)
|
||||
}
|
||||
|
||||
crtBytes, err := ioutil.ReadFile(configAddCmdFlags.crt)
|
||||
crtBytes, err := os.ReadFile(configAddCmdFlags.crt)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading certificate: %w", err)
|
||||
}
|
||||
|
||||
keyBytes, err := ioutil.ReadFile(configAddCmdFlags.key)
|
||||
keyBytes, err := os.ReadFile(configAddCmdFlags.key)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading key: %w", err)
|
||||
}
|
||||
|
@ -208,8 +208,9 @@ func getResourcesResponse(args []string, clientmsg *[]client.ResourceResponse) f
|
||||
}
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
// completeResource represents tab complete options for `get` and `get *` commands.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func completeResource(resourceType string, hasAliasses bool, completeDot bool) []string {
|
||||
var (
|
||||
resourceResponse []client.ResourceResponse
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -120,7 +119,7 @@ Otherwise kubeconfig will be written to PWD or [local-path] if specified.`,
|
||||
return extractAndMerge(data, localPath)
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(localPath, data, 0o640)
|
||||
return os.WriteFile(localPath, data, 0o640)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@ -155,9 +155,10 @@ func dumpPackets(r io.Reader) error {
|
||||
// parseBPFInstructions parses the BPF raw instructions in 'tcpdump -dd' format.
|
||||
//
|
||||
// Example:
|
||||
// { 0x30, 0, 0, 0x00000000 },
|
||||
// { 0x54, 0, 0, 0x000000f0 },
|
||||
// { 0x15, 0, 8, 0x00000060 },
|
||||
//
|
||||
// { 0x30, 0, 0, 0x00000000 },
|
||||
// { 0x54, 0, 0, 0x000000f0 },
|
||||
// { 0x15, 0, 8, 0x00000060 },
|
||||
func parseBPFInstructions(in string) ([]*machine.BPFInstruction, error) {
|
||||
in = strings.TrimSpace(in)
|
||||
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -47,7 +46,7 @@ func ExtractFileFromTarGz(filename string, r io.ReadCloser) ([]byte, error) {
|
||||
return nil, fmt.Errorf("%s is not a file", filename)
|
||||
}
|
||||
|
||||
return ioutil.ReadAll(tr)
|
||||
return io.ReadAll(tr)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// ForEachResource get resources from the controller runtime and run callback using each element.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func ForEachResource(ctx context.Context, c *client.Client, callback func(ctx context.Context, msg client.ResourceResponse) error, namespace string, args ...string) error {
|
||||
if len(args) == 0 {
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module github.com/talos-systems/talos
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
replace (
|
||||
// Use nested module.
|
||||
|
@ -30,10 +30,9 @@ golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
google.golang.org/genproto v0.0.0-20220718134204-073382fd740c h1:xDUAhRezFnKF6wopxkOfdWYvz2XCiRQzndyDdpwFgbc=
|
||||
google.golang.org/genproto v0.0.0-20220718134204-073382fd740c/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE=
|
||||
google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w=
|
||||
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||
k8s.io/api v0.24.2 h1:g518dPU/L7VRLxWfcadQn2OnsiGWVOadTLpdnqgY2OI=
|
||||
k8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg=
|
||||
k8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM=
|
||||
@ -55,7 +54,3 @@ k8s.io/kubectl v0.24.2/go.mod h1:+HIFJc0bA6Tzu5O/YcuUt45APAxnNL8LeMuXwoiGsPg=
|
||||
k8s.io/kubelet v0.24.2 h1:VAvULig8RiylCtyxudgHV7nhKsLnNIrdVBCRD4bXQ3Y=
|
||||
k8s.io/kubelet v0.24.2/go.mod h1:Xm9DkWQjwOs+uGOUIIGIPMvvmenvj0lDVOErvIKOOt0=
|
||||
k8s.io/metrics v0.24.2/go.mod h1:5NWURxZ6Lz5gj8TFU83+vdWIVASx7W8lwPpHYCqopMo=
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.65 h1:gIDtZoGnKeoIZ7XaKRmljMib4JV/TsjUhSzAeShNl6U=
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.65/go.mod h1:Fp9fDSuNh1vVDA7sozXklfQ+LxXMpB5/H4hDR8eu+0s=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.65 h1:v2G3aCgEMr8qh4GpOGMukkv92EE7jtY+Uh9mB7cAACk=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.65/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24=
|
||||
|
@ -1,6 +1,6 @@
|
||||
module github.com/talos-systems/cloud-image-uploader
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go v1.44.66
|
||||
|
@ -1,6 +1,6 @@
|
||||
module github.com/talos-systems/talos-hack-docgen
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
// forked go-yaml that introduces RawYAML interface, which can be used to populate YAML fields using bytes
|
||||
// which are then encoded as a valid YAML blocks with proper indentiation
|
||||
|
@ -250,13 +250,18 @@ func collectStructs(node ast.Node) ([]*structType, map[string]aliasType) {
|
||||
func parseComment(comment []byte) *Text {
|
||||
text := &Text{}
|
||||
if err := yaml.Unmarshal(comment, text); err != nil {
|
||||
lines := strings.Split(string(comment), "\n")
|
||||
for i := range lines {
|
||||
lines[i] = strings.TrimLeft(lines[i], "\t")
|
||||
}
|
||||
|
||||
// not yaml, fallback
|
||||
text.Description = string(comment)
|
||||
text.Description = strings.Join(lines, "\n")
|
||||
// take only the first line from the Description for the comment
|
||||
text.Comment = strings.Split(text.Description, "\n")[0]
|
||||
text.Comment = lines[0]
|
||||
|
||||
// try to parse everything except for the first line as yaml
|
||||
if err = yaml.Unmarshal([]byte(strings.Join(strings.Split(text.Description, "\n")[1:], "\n")), text); err == nil {
|
||||
if err = yaml.Unmarshal([]byte(strings.Join(lines[1:], "\n")), text); err == nil {
|
||||
// if parsed, remove it from the description
|
||||
text.Description = text.Comment
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
module github.com/talos-systems/gotagsrewrite
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/fatih/structtag v1.2.0
|
||||
|
@ -91,9 +91,9 @@ vlan=eth1.5:eth1 ip=172.20.0.2::172.20.0.1:255.255.255.0::eth1.5:::::
|
||||
[notes.updates]
|
||||
title = "Component Updates"
|
||||
description="""\
|
||||
* Linux: 5.15.57
|
||||
* Linux: 5.15.58
|
||||
|
||||
Talos is built with Go 1.18.4.
|
||||
Talos is built with Go 1.19.
|
||||
"""
|
||||
|
||||
[notes.talos-config-kernel-param-variable-substitution]
|
||||
|
@ -96,14 +96,14 @@ func (a *APID) GetConnection(ctx context.Context) (context.Context, *grpc.Client
|
||||
// This method depends on grpc protobuf response structure, each response should
|
||||
// look like:
|
||||
//
|
||||
// message SomeResponse {
|
||||
// repeated SomeReply messages = 1; // please note field ID == 1
|
||||
// }
|
||||
// message SomeResponse {
|
||||
// repeated SomeReply messages = 1; // please note field ID == 1
|
||||
// }
|
||||
//
|
||||
// message SomeReply {
|
||||
// common.Metadata metadata = 1;
|
||||
// <other fields go here ...>
|
||||
// }
|
||||
// message SomeReply {
|
||||
// common.Metadata metadata = 1;
|
||||
// <other fields go here ...>
|
||||
// }
|
||||
//
|
||||
// As 'SomeReply' is repeated in 'SomeResponse', if we concatenate protobuf representation
|
||||
// of several 'SomeResponse' messages, we still get valid 'SomeResponse' representation but with more
|
||||
@ -122,9 +122,9 @@ func (a *APID) GetConnection(ctx context.Context) (context.Context, *grpc.Client
|
||||
// To build only single field (Metadata) we use helper message which contains exactly this
|
||||
// field with same field ID as in every other 'SomeReply':
|
||||
//
|
||||
// message Empty {
|
||||
// common.Metadata metadata = 1;
|
||||
// }
|
||||
// message Empty {
|
||||
// common.Metadata metadata = 1;
|
||||
// }
|
||||
//
|
||||
// As streaming replies are not wrapped into 'SomeResponse' with 'repeated', handling is simpler: we just
|
||||
// need to append Empty with details.
|
||||
@ -190,13 +190,13 @@ func (a *APID) AppendInfo(streaming bool, resp []byte) ([]byte, error) {
|
||||
// So if 'Empty' is unmarshalled into any other reply message, all the fields
|
||||
// are undefined but 'Metadata':
|
||||
//
|
||||
// message Empty {
|
||||
// common.Metadata metadata = 1;
|
||||
// }
|
||||
// message Empty {
|
||||
// common.Metadata metadata = 1;
|
||||
// }
|
||||
//
|
||||
// message EmptyResponse {
|
||||
// repeated Empty messages = 1;
|
||||
// }
|
||||
// message EmptyResponse {
|
||||
// repeated Empty messages = 1;
|
||||
// }
|
||||
//
|
||||
// Streaming responses are not wrapped into Empty, so we simply marshall EmptyResponse
|
||||
// message.
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
@ -235,7 +234,7 @@ Config diff:
|
||||
}
|
||||
|
||||
if in.Mode != machine.ApplyConfigurationRequest_TRY {
|
||||
if err := ioutil.WriteFile(constants.ConfigPath, cfg, 0o600); err != nil {
|
||||
if err := os.WriteFile(constants.ConfigPath, cfg, 0o600); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@ -849,6 +848,7 @@ func (s *Server) List(req *machine.ListRequest, obj machine.MachineService_ListS
|
||||
}
|
||||
|
||||
// DiskUsage implements the machine.MachineServer interface.
|
||||
//
|
||||
//nolint:cyclop
|
||||
func (s *Server) DiskUsage(req *machine.DiskUsageRequest, obj machine.MachineService_DiskUsageServer) error { //nolint:gocyclo
|
||||
if req == nil {
|
||||
@ -1902,6 +1902,7 @@ func (s *Server) EtcdSnapshot(in *machine.EtcdSnapshotRequest, srv machine.Machi
|
||||
}
|
||||
|
||||
// EtcdRecover implements the machine.MachineServer interface.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (s *Server) EtcdRecover(srv machine.MachineService_EtcdRecoverServer) error {
|
||||
if _, err := os.Stat(filepath.Dir(constants.EtcdRecoverySnapshotPath)); err != nil {
|
||||
|
@ -7,7 +7,6 @@ package runtime_test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"testing"
|
||||
@ -116,7 +115,7 @@ func (suite *TimedSuite) TestTimeCheck() {
|
||||
}
|
||||
|
||||
func fakeTimedRPC() (net.Listener, error) {
|
||||
tmpfile, err := ioutil.TempFile("", "timed")
|
||||
tmpfile, err := os.CreateTemp("", "timed")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -54,10 +54,10 @@ const EndpointConnectionTimeout = 15 * time.Second
|
||||
//
|
||||
// The question is where is LastHandshakeTimeout vs. those points above:
|
||||
//
|
||||
// * if we're past (T0+peerDownInterval), simply check that time since last handshake < peerDownInterval
|
||||
// * if we're between (T0+endpointConnectionTimeout) and (T0+peerDownInterval), and there's no handshake
|
||||
// - if we're past (T0+peerDownInterval), simply check that time since last handshake < peerDownInterval
|
||||
// - if we're between (T0+endpointConnectionTimeout) and (T0+peerDownInterval), and there's no handshake
|
||||
// after the endpoint change, assume that the endpoint is down
|
||||
// * if we're between (T0) and (T0+endpointConnectionTimeout), and there's no handshake since the endpoint change,
|
||||
// - if we're between (T0) and (T0+endpointConnectionTimeout), and there's no handshake since the endpoint change,
|
||||
// consider the state to be unknown
|
||||
func (a peerStatus) CalculateState() {
|
||||
sinceLastHandshake := time.Since(a.PeerStatusSpec.LastHandshakeTime)
|
||||
|
@ -7,7 +7,6 @@ package k8s
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -154,7 +153,7 @@ func (ctrl *ExtraManifestController) process(ctx context.Context, r controller.R
|
||||
func (ctrl *ExtraManifestController) processURL(ctx context.Context, r controller.Runtime, logger *zap.Logger, manifest k8s.ExtraManifest, id resource.ID) (err error) {
|
||||
var tmpDir string
|
||||
|
||||
tmpDir, err = ioutil.TempDir("", "talos")
|
||||
tmpDir, err = os.MkdirTemp("", "talos")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -200,7 +199,7 @@ func (ctrl *ExtraManifestController) processURL(ctx context.Context, r controlle
|
||||
|
||||
var contents []byte
|
||||
|
||||
contents, err = ioutil.ReadFile(client.Dst)
|
||||
contents, err = os.ReadFile(client.Dst)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -230,7 +229,7 @@ func (ctrl *KubeletServiceController) writePKI(secretSpec *secrets.KubeletSpec)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(constants.KubeletBootstrapKubeconfig, buf.Bytes(), 0o600); err != nil {
|
||||
if err := os.WriteFile(constants.KubeletBootstrapKubeconfig, buf.Bytes(), 0o600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -238,7 +237,7 @@ func (ctrl *KubeletServiceController) writePKI(secretSpec *secrets.KubeletSpec)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(constants.KubernetesCACert, secretSpec.CA.Crt, 0o400); err != nil {
|
||||
if err := os.WriteFile(constants.KubernetesCACert, secretSpec.CA.Crt, 0o400); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -286,7 +285,7 @@ func (ctrl *KubeletServiceController) writeConfig(cfgSpec *k8s.KubeletSpecSpec)
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile("/etc/kubernetes/kubelet.yaml", buf.Bytes(), 0o600)
|
||||
return os.WriteFile("/etc/kubernetes/kubelet.yaml", buf.Bytes(), 0o600)
|
||||
}
|
||||
|
||||
// updateKubeconfig updates the kubeconfig of kubelet with the given endpoint if it exists.
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -214,7 +213,7 @@ func (ctrl *KubeletStaticPodController) writePod(logger *zap.Logger, staticPod r
|
||||
|
||||
podPath := ctrl.podPath(staticPod)
|
||||
|
||||
existingPod, err := ioutil.ReadFile(podPath)
|
||||
existingPod, err := os.ReadFile(podPath)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
@ -227,7 +226,7 @@ func (ctrl *KubeletStaticPodController) writePod(logger *zap.Logger, staticPod r
|
||||
|
||||
logger.Sugar().Infof("writing static pod %q", podPath)
|
||||
|
||||
return ioutil.WriteFile(podPath, renderedPod, 0o600)
|
||||
return os.WriteFile(podPath, renderedPod, 0o600)
|
||||
}
|
||||
|
||||
func (ctrl *KubeletStaticPodController) teardownPod(logger *zap.Logger, staticPod resource.Resource) error {
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -128,7 +127,7 @@ func (ctrl *RenderConfigsStaticPodController) Run(ctx context.Context, r control
|
||||
return fmt.Errorf("error marshaling configuration %q for %q: %w", configFile.filename, pod.name, err)
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(filepath.Join(pod.directory, configFile.filename), buf.Bytes(), 0o400); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(pod.directory, configFile.filename), buf.Bytes(), 0o400); err != nil {
|
||||
return fmt.Errorf("error writing configuration %q for %q: %w", configFile.filename, pod.name, err)
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
stdlibtemplate "text/template"
|
||||
@ -258,7 +257,7 @@ func (ctrl *RenderSecretsStaticPodController) Run(ctx context.Context, r control
|
||||
certAndKey := secret.getter()
|
||||
|
||||
if secret.certFilename != "" {
|
||||
if err = ioutil.WriteFile(filepath.Join(pod.directory, secret.certFilename), certAndKey.Crt, 0o400); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(pod.directory, secret.certFilename), certAndKey.Crt, 0o400); err != nil {
|
||||
return fmt.Errorf("error writing certificate %q for %q: %w", secret.certFilename, pod.name, err)
|
||||
}
|
||||
|
||||
@ -268,7 +267,7 @@ func (ctrl *RenderSecretsStaticPodController) Run(ctx context.Context, r control
|
||||
}
|
||||
|
||||
if secret.keyFilename != "" {
|
||||
if err = ioutil.WriteFile(filepath.Join(pod.directory, secret.keyFilename), certAndKey.Key, 0o400); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(pod.directory, secret.keyFilename), certAndKey.Key, 0o400); err != nil {
|
||||
return fmt.Errorf("error writing key %q for %q: %w", secret.keyFilename, pod.name, err)
|
||||
}
|
||||
|
||||
@ -302,7 +301,7 @@ func (ctrl *RenderSecretsStaticPodController) Run(ctx context.Context, r control
|
||||
return fmt.Errorf("error executing template %q: %w", templ.filename, err)
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(filepath.Join(pod.directory, templ.filename), buf.Bytes(), 0o400); err != nil {
|
||||
if err = os.WriteFile(filepath.Join(pod.directory, templ.filename), buf.Bytes(), 0o400); err != nil {
|
||||
return fmt.Errorf("error writing template %q for %q: %w", templ.filename, pod.name, err)
|
||||
}
|
||||
|
||||
|
@ -316,6 +316,7 @@ func ParseCmdlineNetwork(cmdline *procfs.Cmdline) (CmdlineNetworking, error) {
|
||||
// parseBondOptions parses the options string into v1alpha1.Bond
|
||||
// v1alpha1.Bond was chosen to re-use the `SetBondMaster` and `SetBondSlave` functions
|
||||
// ref: modinfo bonding
|
||||
//
|
||||
//nolint:gocyclo,cyclop
|
||||
func parseBondOptions(options string) (v1alpha1.Bond, error) {
|
||||
var bond v1alpha1.Bond
|
||||
|
@ -168,8 +168,8 @@ func findLink(links []rtnetlink.LinkMessage, name string) *rtnetlink.LinkMessage
|
||||
// First of all, if the spec is being torn down - remove the link from the kernel, done.
|
||||
// If the link spec is not being torn down, start the sync process:
|
||||
//
|
||||
// * for physical links, there's not much we can sync - only MTU and 'UP' flag
|
||||
// * for logical links, controller handles creation and sync of the settings depending on the interface type
|
||||
// - for physical links, there's not much we can sync - only MTU and 'UP' flag
|
||||
// - for logical links, controller handles creation and sync of the settings depending on the interface type
|
||||
//
|
||||
// If the logical link kind or type got changed (for example, "link0" was a bond, and now it's wireguard interface), the link
|
||||
// is dropped and replaced with the new one.
|
||||
@ -177,9 +177,9 @@ func findLink(links []rtnetlink.LinkMessage, name string) *rtnetlink.LinkMessage
|
||||
//
|
||||
// For bonded links, there are two sync steps applied:
|
||||
//
|
||||
// * bond slave interfaces are enslaved to be part of the bond (by changing MasterIndex)
|
||||
// * bond master link settings are synced with the spec: some settings can't be applied on UP bond and a bond which has slaves,
|
||||
// so slaves are removed and bond is brought down (these settings are going to be reconciled back in the next sync cycle)
|
||||
// - bond slave interfaces are enslaved to be part of the bond (by changing MasterIndex)
|
||||
// - bond master link settings are synced with the spec: some settings can't be applied on UP bond and a bond which has slaves,
|
||||
// so slaves are removed and bond is brought down (these settings are going to be reconciled back in the next sync cycle)
|
||||
//
|
||||
// For wireguard links, only settings are synced with the diff generated by the WireguardSpec.
|
||||
//
|
||||
|
@ -27,6 +27,7 @@ func SetBondSlave(link *network.LinkSpecSpec, bond ordered.Pair[string, int]) {
|
||||
}
|
||||
|
||||
// SetBondMaster sets the bond master spec.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func SetBondMaster(link *network.LinkSpecSpec, bond talosconfig.Bond) error {
|
||||
link.Logical = true
|
||||
@ -125,6 +126,7 @@ func SetBridgeSlave(link *network.LinkSpecSpec, bridge string) {
|
||||
}
|
||||
|
||||
// SetBridgeMaster sets the bridge master spec.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func SetBridgeMaster(link *network.LinkSpecSpec, bridge talosconfig.Bridge) error {
|
||||
link.Logical = true
|
||||
|
@ -59,6 +59,7 @@ func (ctrl *KernelParamSpecController) Outputs() []controller.Output {
|
||||
}
|
||||
|
||||
// Run implements controller.Controller interface.
|
||||
//
|
||||
//nolint:gocyclo,cyclop
|
||||
func (ctrl *KernelParamSpecController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error {
|
||||
if ctrl.state == nil {
|
||||
|
@ -6,7 +6,6 @@ package bananapim64
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -28,9 +27,9 @@ var (
|
||||
// BananaPiM64 represents the Banana Pi M64.
|
||||
//
|
||||
// References:
|
||||
// - http://www.banana-pi.org/m64.html
|
||||
// - http://wiki.banana-pi.org/Banana_Pi_BPI-M64
|
||||
// - https://linux-sunxi.org/Banana_Pi_M64
|
||||
// - http://www.banana-pi.org/m64.html
|
||||
// - http://wiki.banana-pi.org/Banana_Pi_BPI-M64
|
||||
// - https://linux-sunxi.org/Banana_Pi_M64
|
||||
type BananaPiM64 struct{}
|
||||
|
||||
// Name implements the runtime.Board.
|
||||
@ -50,7 +49,7 @@ func (b *BananaPiM64) Install(disk string) (err error) {
|
||||
|
||||
var uboot []byte
|
||||
|
||||
uboot, err = ioutil.ReadFile(bin)
|
||||
uboot, err = os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ func (b JetsonNano) Install(disk string) (err error) {
|
||||
// KernelArgs implements the runtime.Board.
|
||||
//
|
||||
// References:
|
||||
// - https://elinux.org/Jetson/Nano/Upstream to enable early console
|
||||
// - http://en.techinfodepot.shoutwiki.com/wiki/NVIDIA_Jetson_Nano_Developer_Kit for other chips on the SoC
|
||||
// - https://elinux.org/Jetson/Nano/Upstream to enable early console
|
||||
// - http://en.techinfodepot.shoutwiki.com/wiki/NVIDIA_Jetson_Nano_Developer_Kit for other chips on the SoC
|
||||
func (b JetsonNano) KernelArgs() procfs.Parameters {
|
||||
return []*procfs.Parameter{
|
||||
procfs.NewParameter("console").Append("tty0").Append("ttyS0,115200"),
|
||||
|
@ -6,7 +6,6 @@ package libretechallh3cch5
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -47,7 +46,7 @@ func (l *LibretechAllH3CCH5) Install(disk string) (err error) {
|
||||
|
||||
var uboot []byte
|
||||
|
||||
uboot, err = ioutil.ReadFile(bin)
|
||||
uboot, err = os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ package pine64
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -28,7 +27,7 @@ var (
|
||||
// Pine64 represents the Pine64 board
|
||||
//
|
||||
// References:
|
||||
// - http://linux-sunxi.org/Pine64
|
||||
// - http://linux-sunxi.org/Pine64
|
||||
type Pine64 struct{}
|
||||
|
||||
// Name implements the runtime.Board.
|
||||
@ -48,7 +47,7 @@ func (b Pine64) Install(disk string) (err error) {
|
||||
|
||||
var uboot []byte
|
||||
|
||||
uboot, err = ioutil.ReadFile(bin)
|
||||
uboot, err = os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ package rock64
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -47,7 +46,7 @@ func (r *Rock64) Install(disk string) (err error) {
|
||||
|
||||
var uboot []byte
|
||||
|
||||
uboot, err = ioutil.ReadFile(bin)
|
||||
uboot, err = os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ package rockpi4
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -47,7 +46,7 @@ func (r *Rockpi4) Install(disk string) (err error) {
|
||||
|
||||
defer f.Close() //nolint:errcheck
|
||||
|
||||
uboot, err := ioutil.ReadFile(bin)
|
||||
uboot, err := os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ package rockpi4c
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -46,7 +45,7 @@ func (r *Rockpi4c) Install(disk string) (err error) {
|
||||
|
||||
defer f.Close() //nolint:errcheck
|
||||
|
||||
uboot, err := ioutil.ReadFile(bin)
|
||||
uboot, err := os.ReadFile(bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ package rpi4
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/talos-systems/go-procfs/procfs"
|
||||
|
||||
@ -45,7 +45,7 @@ func (r *RPi4) Install(disk string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile("/boot/EFI/config.txt", configTxt, 0o600)
|
||||
return os.WriteFile("/boot/EFI/config.txt", configTxt, 0o600)
|
||||
}
|
||||
|
||||
// KernelArgs implements the runtime.Board.
|
||||
|
@ -39,13 +39,14 @@ type Value []byte
|
||||
// ADV implements the Talos extended ADV.
|
||||
//
|
||||
// Layout (all in big-endian):
|
||||
// 0x0000 4 bytes magic1
|
||||
// 0x0004 4 bytes tag
|
||||
// 0x0008 4 bytes size
|
||||
// 0x000c (size) bytes value
|
||||
// ... more tags
|
||||
// -0x0024 32 bytes sha256 of the whole block with checksum set to zero
|
||||
// -0x0004 4 bytes magic2
|
||||
//
|
||||
// 0x0000 4 bytes magic1
|
||||
// 0x0004 4 bytes tag
|
||||
// 0x0008 4 bytes size
|
||||
// 0x000c (size) bytes value
|
||||
// ... more tags
|
||||
// -0x0024 32 bytes sha256 of the whole block with checksum set to zero
|
||||
// -0x0004 4 bytes magic2
|
||||
//
|
||||
// Whole data structure is written twice for redundancy.
|
||||
type ADV struct {
|
||||
|
@ -7,7 +7,6 @@ package grub
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
)
|
||||
@ -22,7 +21,7 @@ var (
|
||||
|
||||
// Read reads the grub configuration from the disk.
|
||||
func Read(path string) (*Config, error) {
|
||||
c, err := ioutil.ReadFile(path)
|
||||
c, err := os.ReadFile(path)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ package grub
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -51,7 +50,7 @@ func (c *Config) Write(path string) error {
|
||||
|
||||
log.Printf("writing %s to disk", path)
|
||||
|
||||
return ioutil.WriteFile(path, wr.Bytes(), 0o600)
|
||||
return os.WriteFile(path, wr.Bytes(), 0o600)
|
||||
}
|
||||
|
||||
// Encode writes the grub configuration to the given writer.
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -77,7 +76,7 @@ func TestWrite(t *testing.T) {
|
||||
version.Name = "Test"
|
||||
version.Tag = "v0.0.1"
|
||||
|
||||
tempFile, _ := ioutil.TempFile("", "talos-test-grub-*.cfg")
|
||||
tempFile, _ := os.CreateTemp("", "talos-test-grub-*.cfg")
|
||||
|
||||
defer os.Remove(tempFile.Name())
|
||||
|
||||
@ -86,7 +85,7 @@ func TestWrite(t *testing.T) {
|
||||
err := config.Write(tempFile.Name())
|
||||
assert.NoError(t, err)
|
||||
|
||||
written, _ := ioutil.ReadFile(tempFile.Name())
|
||||
written, _ := os.ReadFile(tempFile.Name())
|
||||
assert.Equal(t, newConfig, string(written))
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ const (
|
||||
)
|
||||
|
||||
// Install validates the grub configuration and writes it to the disk.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (c *Config) Install(bootDisk, arch string) error {
|
||||
if err := c.Write(ConfigPath); err != nil {
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"encoding/xml"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -188,9 +187,10 @@ func (a *Azure) KernelArgs() procfs.Parameters {
|
||||
}
|
||||
|
||||
// configFromCD handles looking for devices and trying to mount/fetch xml to get the custom data.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (a *Azure) configFromCD() ([]byte, error) {
|
||||
devList, err := ioutil.ReadDir("/dev")
|
||||
devList, err := os.ReadDir("/dev")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -208,7 +208,7 @@ func (a *Azure) configFromCD() ([]byte, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
ovfEnvFile, err := ioutil.ReadFile(filepath.Join(mnt, "ovf-env.xml"))
|
||||
ovfEnvFile, err := os.ReadFile(filepath.Join(mnt, "ovf-env.xml"))
|
||||
if err != nil {
|
||||
// Device mount worked, but it wasn't the "CD" that contains the xml file
|
||||
if os.IsNotExist(err) {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
@ -106,7 +106,7 @@ func reportHealth(ctx context.Context, gsIncarnation, gsContainerID, gsInstanceI
|
||||
//nolint:errcheck
|
||||
defer resp.Body.Close()
|
||||
|
||||
_, err = ioutil.ReadAll(resp.Body)
|
||||
_, err = io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
@ -59,7 +58,7 @@ func (c *Container) KernelArgs() procfs.Parameters {
|
||||
func (c *Container) NetworkConfiguration(ctx context.Context, ch chan<- *runtime.PlatformNetworkConfig) error {
|
||||
networkConfig := &runtime.PlatformNetworkConfig{}
|
||||
|
||||
hostname, err := ioutil.ReadFile("/etc/hostname")
|
||||
hostname, err := os.ReadFile("/etc/hostname")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ package metal
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -126,6 +126,7 @@ func (r *replacer) ReplaceMatches(replacement string) string {
|
||||
}
|
||||
|
||||
// PopulateURLParameters fills in empty parameters in the download URL.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func PopulateURLParameters(ctx context.Context, downloadURL string, r state.State) (string, error) {
|
||||
populatedURL := downloadURL
|
||||
@ -314,7 +315,7 @@ func readConfigFromISO() ([]byte, error) {
|
||||
return nil, fmt.Errorf("failed to mount iso: %w", err)
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadFile(filepath.Join(mnt, filepath.Base(constants.ConfigPath)))
|
||||
b, err := os.ReadFile(filepath.Join(mnt, filepath.Base(constants.ConfigPath)))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read config: %s", err.Error())
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ package nocloud
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -145,7 +145,7 @@ func (n *Nocloud) configFromCD() (metaConfig []byte, networkConfig []byte, machi
|
||||
|
||||
log.Printf("fetching meta config from: cidata/%s", configMetaDataPath)
|
||||
|
||||
metaConfig, err = ioutil.ReadFile(filepath.Join(mnt, configMetaDataPath))
|
||||
metaConfig, err = os.ReadFile(filepath.Join(mnt, configMetaDataPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configMetaDataPath)
|
||||
|
||||
@ -154,7 +154,7 @@ func (n *Nocloud) configFromCD() (metaConfig []byte, networkConfig []byte, machi
|
||||
|
||||
log.Printf("fetching network config from: cidata/%s", configNetworkConfigPath)
|
||||
|
||||
networkConfig, err = ioutil.ReadFile(filepath.Join(mnt, configNetworkConfigPath))
|
||||
networkConfig, err = os.ReadFile(filepath.Join(mnt, configNetworkConfigPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configNetworkConfigPath)
|
||||
|
||||
@ -163,7 +163,7 @@ func (n *Nocloud) configFromCD() (metaConfig []byte, networkConfig []byte, machi
|
||||
|
||||
log.Printf("fetching machine config from: cidata/%s", configUserDataPath)
|
||||
|
||||
machineConfig, err = ioutil.ReadFile(filepath.Join(mnt, configUserDataPath))
|
||||
machineConfig, err = os.ReadFile(filepath.Join(mnt, configUserDataPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configUserDataPath)
|
||||
|
||||
|
@ -7,8 +7,8 @@ package openstack
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/talos-systems/go-blockdevice/blockdevice/filesystem"
|
||||
@ -122,7 +122,7 @@ func (o *Openstack) configFromCD() (metaConfig []byte, networkConfig []byte, mac
|
||||
|
||||
log.Printf("fetching meta config from: config-drive/%s", configMetadataPath)
|
||||
|
||||
metaConfig, err = ioutil.ReadFile(filepath.Join(mnt, configMetadataPath))
|
||||
metaConfig, err = os.ReadFile(filepath.Join(mnt, configMetadataPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configMetadataPath)
|
||||
|
||||
@ -131,7 +131,7 @@ func (o *Openstack) configFromCD() (metaConfig []byte, networkConfig []byte, mac
|
||||
|
||||
log.Printf("fetching network config from: config-drive/%s", configNetworkDataPath)
|
||||
|
||||
networkConfig, err = ioutil.ReadFile(filepath.Join(mnt, configNetworkDataPath))
|
||||
networkConfig, err = os.ReadFile(filepath.Join(mnt, configNetworkDataPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configNetworkDataPath)
|
||||
|
||||
@ -140,7 +140,7 @@ func (o *Openstack) configFromCD() (metaConfig []byte, networkConfig []byte, mac
|
||||
|
||||
log.Printf("fetching machine config from: config-drive/%s", configUserDataPath)
|
||||
|
||||
machineConfig, err = ioutil.ReadFile(filepath.Join(mnt, configUserDataPath))
|
||||
machineConfig, err = os.ReadFile(filepath.Join(mnt, configUserDataPath))
|
||||
if err != nil {
|
||||
log.Printf("failed to read %s", configUserDataPath)
|
||||
|
||||
|
@ -32,6 +32,7 @@ func (o *Openstack) Name() string {
|
||||
}
|
||||
|
||||
// ParseMetadata converts OpenStack metadata to platform network configuration.
|
||||
//
|
||||
//nolint:gocyclo,cyclop
|
||||
func (o *Openstack) ParseMetadata(unmarshalledMetadataConfig *MetadataConfig, unmarshalledNetworkConfig *NetworkConfig, hostname string, extIPs []netaddr.IP) (*runtime.PlatformNetworkConfig, error) {
|
||||
networkConfig := &runtime.PlatformNetworkConfig{}
|
||||
|
@ -111,6 +111,7 @@ func readConfigFromOvf(extraConfig *rpcvmx.Config, key string) ([]byte, error) {
|
||||
}
|
||||
|
||||
// Configuration implements the platform.Platform interface.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (v *VMware) Configuration(context.Context, state.State) ([]byte, error) {
|
||||
var option *string
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
@ -73,6 +72,7 @@ func NewController() (*Controller, error) {
|
||||
|
||||
// Run executes all phases known to the controller in serial. `Controller`
|
||||
// aborts immediately if any phase fails.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (c *Controller) Run(ctx context.Context, seq runtime.Sequence, data interface{}, setters ...runtime.LockOption) error {
|
||||
// We must ensure that the runtime is configured since all sequences depend
|
||||
@ -406,7 +406,7 @@ func waitForUSBDelay() (err error) {
|
||||
if wait {
|
||||
var b []byte
|
||||
|
||||
b, err = ioutil.ReadFile(file)
|
||||
b, err = os.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -33,17 +33,17 @@ import (
|
||||
// local to each Consumer, as Consumers are free to work on their own pace. Following diagram shows
|
||||
// Publisher and three Consumers:
|
||||
//
|
||||
// Consumer 3 Consumer 2
|
||||
// pos = 27 pos = 34
|
||||
// e.stream []Event | |
|
||||
// | |
|
||||
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |17 |
|
||||
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
// | |
|
||||
// | |
|
||||
// Consumer 1 Publisher
|
||||
// pos = 43 e.writePos = 50
|
||||
// Consumer 3 Consumer 2
|
||||
// pos = 27 pos = 34
|
||||
// e.stream []Event | |
|
||||
// | |
|
||||
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |17 |
|
||||
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|
||||
// | |
|
||||
// | |
|
||||
// Consumer 1 Publisher
|
||||
// pos = 43 e.writePos = 50
|
||||
//
|
||||
// Capacity of Events in this diagram is 18, Publisher published already 50 events, so it
|
||||
// already overwrote `e.stream` twice fully.
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -425,7 +424,7 @@ func OSRelease() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(filepath.Join(constants.SystemEtcPath, "os-release"), writer.Bytes(), 0o644)
|
||||
return os.WriteFile(filepath.Join(constants.SystemEtcPath, "os-release"), writer.Bytes(), 0o644)
|
||||
}
|
||||
|
||||
// createBindMount creates a common way to create a writable source file with a
|
||||
@ -575,7 +574,7 @@ func SaveConfig(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFu
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(constants.ConfigPath, b, 0o600)
|
||||
return os.WriteFile(constants.ConfigPath, b, 0o600)
|
||||
}, "saveConfig"
|
||||
}
|
||||
|
||||
@ -601,7 +600,7 @@ func fetchConfig(ctx context.Context, r runtime.Runtime) (out []byte, err error)
|
||||
|
||||
var unzippedData []byte
|
||||
|
||||
unzippedData, err = ioutil.ReadAll(gzipReader)
|
||||
unzippedData, err = io.ReadAll(gzipReader)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error unzipping machine config: %w", err)
|
||||
}
|
||||
@ -702,7 +701,7 @@ func WriteUdevRules(seq runtime.Sequence, data interface{}) (runtime.TaskExecuti
|
||||
content.WriteByte('\n')
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(constants.UdevRulesPath, []byte(content.String()), 0o644); err != nil {
|
||||
if err = os.WriteFile(constants.UdevRulesPath, []byte(content.String()), 0o644); err != nil {
|
||||
return fmt.Errorf("failed writing custom udev rules: %w", err)
|
||||
}
|
||||
|
||||
@ -1035,7 +1034,7 @@ func WriteUserFiles(seq runtime.Sequence, data interface{}) (runtime.TaskExecuti
|
||||
|
||||
var existingFileContents []byte
|
||||
|
||||
existingFileContents, err = ioutil.ReadFile(f.Path())
|
||||
existingFileContents, err = os.ReadFile(f.Path())
|
||||
if err != nil {
|
||||
result = multierror.Append(result, err)
|
||||
|
||||
@ -1050,7 +1049,7 @@ func WriteUserFiles(seq runtime.Sequence, data interface{}) (runtime.TaskExecuti
|
||||
}
|
||||
|
||||
if filepath.Dir(f.Path()) == constants.ManifestsDirectory {
|
||||
if err = ioutil.WriteFile(f.Path(), []byte(content), f.Permissions()); err != nil {
|
||||
if err = os.WriteFile(f.Path(), []byte(content), f.Permissions()); err != nil {
|
||||
result = multierror.Append(result, err)
|
||||
|
||||
continue
|
||||
@ -1091,7 +1090,7 @@ func WriteUserFiles(seq runtime.Sequence, data interface{}) (runtime.TaskExecuti
|
||||
continue
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(p, []byte(content), f.Permissions()); err != nil {
|
||||
if err = os.WriteFile(p, []byte(content), f.Permissions()); err != nil {
|
||||
result = multierror.Append(result, err)
|
||||
|
||||
continue
|
||||
@ -1173,7 +1172,7 @@ func UnmountPodMounts(seq runtime.Sequence, data interface{}) (runtime.TaskExecu
|
||||
return func(ctx context.Context, logger *log.Logger, r runtime.Runtime) (err error) {
|
||||
var b []byte
|
||||
|
||||
if b, err = ioutil.ReadFile("/proc/self/mounts"); err != nil {
|
||||
if b, err = os.ReadFile("/proc/self/mounts"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -154,7 +154,7 @@ func (suite *ContainerdSuite) getLogContents(filename string) []byte {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
return logContents
|
||||
@ -268,7 +268,7 @@ func (suite *ContainerdSuite) TestRunLogs() {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
suite.Assert().Equal([]byte("Test 1\nTest 2\n"), logContents)
|
||||
@ -420,7 +420,7 @@ func (suite *ContainerdSuite) TestContainerStdin() {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
suite.Assert().Equal(stdin, logContents)
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -157,7 +156,7 @@ func (suite *GoroutineSuite) TestRunLogs() {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
suite.Assert().Equal([]byte("Test 1\nTest 2\n"), logContents)
|
||||
|
@ -6,7 +6,7 @@ package process_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -87,7 +87,7 @@ func (suite *ProcessSuite) TestRunLogs() {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
suite.Assert().Equal([]byte("Test 1\nTest 2\n"), logContents)
|
||||
@ -123,7 +123,7 @@ func (suite *ProcessSuite) TestRunRestartFailed() {
|
||||
//nolint:errcheck
|
||||
defer logFile.Close()
|
||||
|
||||
logContents, err := ioutil.ReadAll(logFile)
|
||||
logContents, err := io.ReadAll(logFile)
|
||||
suite.Assert().NoError(err)
|
||||
|
||||
return logContents
|
||||
|
@ -100,6 +100,7 @@ func (r *restarter) Open() error {
|
||||
}
|
||||
|
||||
// Run implements the Runner interface
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (r *restarter) Run(eventSink events.Recorder) error {
|
||||
defer close(r.stopped)
|
||||
|
@ -184,6 +184,7 @@ func (svcrunner *ServiceRunner) waitFor(ctx context.Context, condition condition
|
||||
// Start initializes the service and runs it
|
||||
//
|
||||
// Start should be run in a goroutine.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (svcrunner *ServiceRunner) Start() {
|
||||
defer func() {
|
||||
|
@ -6,7 +6,6 @@ package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -25,7 +24,7 @@ func prepareRootfs(id string) error {
|
||||
|
||||
executablePath := filepath.Join(rootfsPath, id)
|
||||
|
||||
if err := ioutil.WriteFile(executablePath, nil, 0o555); err != nil { // r-xr-xr-x, non-root programs should be able to execute & read
|
||||
if err := os.WriteFile(executablePath, nil, 0o555); err != nil { // r-xr-xr-x, non-root programs should be able to execute & read
|
||||
return fmt.Errorf("failed to create empty executable %q: %w", executablePath, err)
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ var (
|
||||
)
|
||||
|
||||
// Services returns the instance of the system services API.
|
||||
//
|
||||
//nolint:revive,golint
|
||||
func Services(runtime runtime.Runtime) *singleton {
|
||||
once.Do(func() {
|
||||
|
@ -41,7 +41,6 @@ import (
|
||||
// - not be defined by the default Talos configuration
|
||||
//
|
||||
// - be generally harmless
|
||||
//
|
||||
const applyConfigTestSysctl = "net.ipv6.conf.all.accept_ra_mtu"
|
||||
|
||||
const applyConfigTestSysctlVal = "1"
|
||||
@ -451,6 +450,7 @@ func (suite *ApplyConfigSuite) TestApplyDryRun() {
|
||||
}
|
||||
|
||||
// TestApplyTry applies the config in try mode with a short timeout.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (suite *ApplyConfigSuite) TestApplyTry() {
|
||||
nodes := suite.DiscoverNodeInternalIPsByType(suite.ctx, machine.TypeWorker)
|
||||
|
@ -10,7 +10,6 @@ package api
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/talos-systems/talos/internal/integration/base"
|
||||
@ -56,7 +55,7 @@ func (suite *DmesgSuite) TestNodeHasDmesg() {
|
||||
logReader, errCh, err := client.ReadStream(dmesgStream)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
n, err := io.Copy(ioutil.Discard, logReader)
|
||||
n, err := io.Copy(io.Discard, logReader)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().NoError(<-errCh)
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/talos-systems/talos/internal/integration/base"
|
||||
@ -74,7 +73,7 @@ func (suite *LogsSuite) TestServicesHaveLogs() {
|
||||
logReader, errCh, err := client.ReadStream(logsStream)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
n, err := io.Copy(ioutil.Discard, logReader)
|
||||
n, err := io.Copy(io.Discard, logReader)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
logsSize += n
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -197,14 +196,14 @@ func (apiSuite *APISuite) ReadBootID(ctx context.Context) (string, error) {
|
||||
|
||||
defer reader.Close() //nolint:errcheck
|
||||
|
||||
body, err := ioutil.ReadAll(reader)
|
||||
body, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
bootID := strings.TrimSpace(string(body))
|
||||
|
||||
_, err = io.Copy(ioutil.Discard, reader)
|
||||
_, err = io.Copy(io.Discard, reader)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ type Handler struct {
|
||||
}
|
||||
|
||||
// Open encrypted partition.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (h *Handler) Open() (string, error) {
|
||||
partPath, err := h.partition.Path()
|
||||
|
@ -5,7 +5,6 @@
|
||||
package mount_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@ -45,7 +44,7 @@ func (suite *manifestSuite) SetupTest() {
|
||||
|
||||
var err error
|
||||
|
||||
suite.disk, err = ioutil.TempFile("", "talos")
|
||||
suite.disk, err = os.CreateTemp("", "talos")
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().NoError(suite.disk.Truncate(diskSize))
|
||||
|
@ -60,6 +60,7 @@ func SystemMountPointsForDevice(devpath string, opts ...Option) (mountpoints *Po
|
||||
}
|
||||
|
||||
// SystemMountPointForLabel returns a mount point for the specified device and label.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func SystemMountPointForLabel(device *blockdevice.BlockDevice, label string, opts ...Option) (mountpoint *Point, err error) {
|
||||
var target string
|
||||
|
@ -9,14 +9,14 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const sysfsPath = "/sys/bus/pci/devices/%s/%s"
|
||||
|
||||
func readID(busPath, name string) (uint16, error) {
|
||||
contents, err := ioutil.ReadFile(fmt.Sprintf(sysfsPath, busPath, name))
|
||||
contents, err := os.ReadFile(fmt.Sprintf(sysfsPath, busPath, name))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ func (item *Item) assign(value string) error {
|
||||
}
|
||||
|
||||
// createFormItems dynamically creates tview.FormItem list based on the wrapped type.
|
||||
//
|
||||
//nolint:gocyclo,cyclop
|
||||
func (item *Item) createFormItems() ([]tview.Primitive, error) {
|
||||
res := []tview.Primitive{}
|
||||
|
@ -32,6 +32,7 @@ var customCNIPresets = map[string][]string{
|
||||
}
|
||||
|
||||
// NewState creates new installer state.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func NewState(ctx context.Context, installer *Installer, conn *Connection) (*State, error) {
|
||||
opts := &machineapi.GenerateConfigurationRequest{
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -48,7 +47,7 @@ func (suite *TarSuite) TestArchiveDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadAll(tr)
|
||||
contents, err := io.ReadAll(tr)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
found := false
|
||||
@ -105,7 +104,7 @@ func (suite *TarSuite) TestArchiveFile() {
|
||||
suite.Require().EqualValues(hdr.Name, "cp")
|
||||
suite.Require().EqualValues(hdr.Size, len(expectedContents))
|
||||
|
||||
contents, err := ioutil.ReadAll(tr)
|
||||
contents, err := io.ReadAll(tr)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().Equal(expectedContents, contents)
|
||||
|
@ -7,7 +7,6 @@ package archiver_test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -151,7 +150,7 @@ func (suite *WalkerSuite) TestIterationSymlink() {
|
||||
suite.Require().NoError(err)
|
||||
}()
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(original, "original.txt"), []byte{}, 0o666)
|
||||
err = os.WriteFile(filepath.Join(original, "original.txt"), []byte{}, 0o666)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
ch, err := archiver.Walker(context.Background(), newname)
|
||||
|
@ -29,6 +29,7 @@ func (a Args) MustMerge(args Args, setters ...MergeOption) {
|
||||
}
|
||||
|
||||
// Merge implements the ArgsBuilder interface.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (a Args) Merge(args Args, setters ...MergeOption) error {
|
||||
var opts MergeOptions
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -221,7 +220,7 @@ func (suite *CircularSuite) TestStreamingLateAndIdleReaders() {
|
||||
suite.Require().NoError(lateR.Close())
|
||||
}()
|
||||
|
||||
actual, err := ioutil.ReadAll(lateR)
|
||||
actual, err := io.ReadAll(lateR)
|
||||
suite.Require().Equal(circular.ErrClosed, err)
|
||||
suite.Require().Equal(65536-256, len(actual))
|
||||
|
||||
@ -233,7 +232,7 @@ func (suite *CircularSuite) TestStreamingLateAndIdleReaders() {
|
||||
suite.Require().NoError(idleR.Close())
|
||||
}()
|
||||
|
||||
actual, err = ioutil.ReadAll(idleR)
|
||||
actual, err = io.ReadAll(idleR)
|
||||
suite.Require().Equal(circular.ErrClosed, err)
|
||||
suite.Require().Equal(65536, len(actual))
|
||||
|
||||
@ -319,7 +318,7 @@ func (suite *CircularSuite) TestRegularReader() {
|
||||
_, err = buf.Write(bytes.Repeat([]byte{0xfe}, 512))
|
||||
suite.Require().NoError(err)
|
||||
|
||||
actual, err := ioutil.ReadAll(r)
|
||||
actual, err := io.ReadAll(r)
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(bytes.Repeat([]byte{0xff}, 512), actual)
|
||||
}
|
||||
@ -352,7 +351,7 @@ func (suite *CircularSuite) TestRegularReaderFull() {
|
||||
_, err = buf.Write(bytes.Repeat([]byte{0xfe}, 100))
|
||||
suite.Require().NoError(err)
|
||||
|
||||
actual, err := ioutil.ReadAll(r)
|
||||
actual, err := io.ReadAll(r)
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(bytes.Repeat([]byte{0xff}, 4096-256), actual)
|
||||
|
||||
|
@ -68,6 +68,7 @@ func RenderMounts(resp *machine.MountsResponse, output io.Writer, remotePeer *pe
|
||||
}
|
||||
|
||||
// RenderGraph renders inspect controller runtime graph.
|
||||
//
|
||||
//nolint:gocyclo,cyclop
|
||||
func RenderGraph(ctx context.Context, c *client.Client, resp *inspect.ControllerRuntimeDependenciesResponse, output io.Writer, withResources bool) error {
|
||||
graph := dot.NewGraph(dot.Directed)
|
||||
|
@ -31,6 +31,7 @@ type APIBootstrapper struct {
|
||||
// Bootstrap the cluster via the API.
|
||||
//
|
||||
// Bootstrap implements Bootstrapper interface.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func (s *APIBootstrapper) Bootstrap(ctx context.Context, out io.Writer) error {
|
||||
cli, err := s.Client()
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
// EtcdConsistentAssertion checks that etcd membership is consistent across nodes.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func EtcdConsistentAssertion(ctx context.Context, cl ClusterInfo) error {
|
||||
cli, err := cl.Client()
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
// AllNodesBootedAssertion checks whether nodes reached end of 'Boot' sequence.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func AllNodesBootedAssertion(ctx context.Context, cluster ClusterInfo) error {
|
||||
cli, err := cluster.Client()
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
)
|
||||
|
||||
// K8sAllNodesReportedAssertion checks whether all the nodes show up in node list.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func K8sAllNodesReportedAssertion(ctx context.Context, cl ClusterInfo) error {
|
||||
clientset, err := cl.K8sClient(ctx)
|
||||
|
@ -68,6 +68,7 @@ func ServiceStateAssertion(ctx context.Context, cl ClusterInfo, service string,
|
||||
}
|
||||
|
||||
// ServiceHealthAssertion checks whether service reached some specified state.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func ServiceHealthAssertion(ctx context.Context, cl ClusterInfo, service string, setters ...Option) error {
|
||||
opts := DefaultOptions()
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// DetectLowestVersion returns lowest Kubernetes components versions in the cluster.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func DetectLowestVersion(ctx context.Context, cluster UpgradeProvider, options UpgradeOptions) (string, error) {
|
||||
k8sClient, err := cluster.K8sHelper(ctx)
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -159,7 +158,7 @@ func Run(ctx context.Context, cluster cluster.K8sProvider, options *Options) err
|
||||
return fmt.Errorf("error setting up log reader: %w", err)
|
||||
}
|
||||
|
||||
logF, err := ioutil.TempFile("", "talos")
|
||||
logF, err := os.CreateTemp("", "talos")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating temporary file for logs: %w", err)
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -139,6 +138,7 @@ var nodeCollectors = []nodeCollector{
|
||||
}
|
||||
|
||||
// GetNodeSupportBundle writes all node information we can gather into a zip archive.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func GetNodeSupportBundle(ctx context.Context, options *BundleOptions) error {
|
||||
var errors error
|
||||
@ -228,6 +228,7 @@ func GetNodeSupportBundle(ctx context.Context, options *BundleOptions) error {
|
||||
}
|
||||
|
||||
// GetKubernetesSupportBundle writes cluster wide kubernetes information into a zip archive.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func GetKubernetesSupportBundle(ctx context.Context, options *BundleOptions) error {
|
||||
var clientset *kubernetes.Clientset
|
||||
@ -641,7 +642,7 @@ func devices(ctx context.Context, options *BundleOptions) ([]byte, error) {
|
||||
|
||||
defer r.Close() //nolint:errcheck
|
||||
|
||||
return ioutil.ReadAll(r)
|
||||
return io.ReadAll(r)
|
||||
}
|
||||
|
||||
func ioPressure(ctx context.Context, options *BundleOptions) ([]byte, error) {
|
||||
|
@ -6,7 +6,7 @@ package copy //nolint:predeclared
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
@ -62,7 +62,7 @@ func File(src, dst string, setters ...Option) error {
|
||||
func Dir(src, dst string, setters ...Option) error {
|
||||
var (
|
||||
err error
|
||||
files []os.FileInfo
|
||||
files []fs.DirEntry
|
||||
info os.FileInfo
|
||||
options Options
|
||||
)
|
||||
@ -85,7 +85,7 @@ func Dir(src, dst string, setters ...Option) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if files, err = ioutil.ReadDir(src); err != nil {
|
||||
if files, err = os.ReadDir(src); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,12 @@ import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@ -123,7 +124,7 @@ func Download(ctx context.Context, endpoint string, opts ...Option) (b []byte, e
|
||||
|
||||
if u.Scheme == "file" {
|
||||
var fileContent []byte
|
||||
fileContent, err = ioutil.ReadFile(u.Path)
|
||||
fileContent, err = os.ReadFile(u.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -202,7 +203,7 @@ func download(req *http.Request, dlOpts *downloadOptions) (data []byte, err erro
|
||||
return data, retry.ExpectedError(fmt.Errorf("failed to download config, received %d", resp.StatusCode))
|
||||
}
|
||||
|
||||
data, err = ioutil.ReadAll(resp.Body)
|
||||
data, err = io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return data, retry.ExpectedError(fmt.Errorf("read config: %s", err.Error()))
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package download
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/pin/tftp"
|
||||
@ -59,7 +59,7 @@ func (t *tftpRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
|
||||
Proto: "TFTP/1.0",
|
||||
ProtoMajor: 1,
|
||||
ProtoMinor: 0,
|
||||
Body: ioutil.NopCloser(buf),
|
||||
Body: io.NopCloser(buf),
|
||||
ContentLength: -1,
|
||||
Request: req,
|
||||
}, nil
|
||||
|
@ -5,7 +5,6 @@
|
||||
package kernel
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/talos-systems/talos/pkg/machinery/kernel"
|
||||
@ -13,12 +12,12 @@ import (
|
||||
|
||||
// WriteParam writes a value to a key under /proc/sys.
|
||||
func WriteParam(prop *kernel.Param) error {
|
||||
return ioutil.WriteFile(prop.Path(), []byte(prop.Value), 0o644)
|
||||
return os.WriteFile(prop.Path(), []byte(prop.Value), 0o644)
|
||||
}
|
||||
|
||||
// ReadParam reads a value from a key under /proc/sys.
|
||||
func ReadParam(prop *kernel.Param) ([]byte, error) {
|
||||
return ioutil.ReadFile(prop.Path())
|
||||
return os.ReadFile(prop.Path())
|
||||
}
|
||||
|
||||
// DeleteParam deletes a value from a key under /proc/sys.
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@ -45,7 +44,7 @@ func NewClient(nodename string, clientCert, clientKey, caPEM []byte) (*Client, e
|
||||
},
|
||||
}
|
||||
|
||||
kubeletCert, err := ioutil.ReadFile(filepath.Join(constants.KubeletPKIDir, "kubelet.crt"))
|
||||
kubeletCert, err := os.ReadFile(filepath.Join(constants.KubeletPKIDir, "kubelet.crt"))
|
||||
if err == nil {
|
||||
config.CAData = append(config.CAData, kubeletCert...)
|
||||
} else if err != nil {
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -113,7 +112,7 @@ func (c *Config) Save(p string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(p, configBytes, 0o600); err != nil {
|
||||
if err = os.WriteFile(p, configBytes, 0o600); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user