diff --git a/Dockerfile b/Dockerfile index fcad15aa2a..cb7a3f46a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 0c01fea183..1194f09df2 100644 --- a/Makefile +++ b/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 diff --git a/cmd/installer/cmd/iso.go b/cmd/installer/cmd/iso.go index 7b32ba403b..1b0a10c59f 100644 --- a/cmd/installer/cmd/iso.go +++ b/cmd/installer/cmd/iso.go @@ -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 } diff --git a/cmd/installer/pkg/install/manifest_test.go b/cmd/installer/pkg/install/manifest_test.go index f16b933cf1..013b725665 100644 --- a/cmd/installer/pkg/install/manifest_test.go +++ b/cmd/installer/pkg/install/manifest_test.go @@ -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()) diff --git a/cmd/installer/pkg/ova/ova.go b/cmd/installer/pkg/ova/ova.go index 65ed6790ca..f2a09163bd 100644 --- a/cmd/installer/pkg/ova/ova.go +++ b/cmd/installer/pkg/ova/ova.go @@ -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 = ` @@ -138,9 +138,10 @@ const ovfTpl = ` ` // 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 } diff --git a/cmd/talosctl/cmd/mgmt/gen/ca.go b/cmd/talosctl/cmd/mgmt/gen/ca.go index 4e4b509562..f5b2eee706 100644 --- a/cmd/talosctl/cmd/mgmt/gen/ca.go +++ b/cmd/talosctl/cmd/mgmt/gen/ca.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/config.go b/cmd/talosctl/cmd/mgmt/gen/config.go index f7432d214c..39d0814858 100644 --- a/cmd/talosctl/cmd/mgmt/gen/config.go +++ b/cmd/talosctl/cmd/mgmt/gen/config.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/crt.go b/cmd/talosctl/cmd/mgmt/gen/crt.go index 34e7542cb0..d9e41756db 100644 --- a/cmd/talosctl/cmd/mgmt/gen/crt.go +++ b/cmd/talosctl/cmd/mgmt/gen/crt.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/csr.go b/cmd/talosctl/cmd/mgmt/gen/csr.go index 9a00e9fa2a..dd26e3ebce 100644 --- a/cmd/talosctl/cmd/mgmt/gen/csr.go +++ b/cmd/talosctl/cmd/mgmt/gen/csr.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/key.go b/cmd/talosctl/cmd/mgmt/gen/key.go index 31cd6b763a..1d41258e37 100644 --- a/cmd/talosctl/cmd/mgmt/gen/key.go +++ b/cmd/talosctl/cmd/mgmt/gen/key.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/keypair.go b/cmd/talosctl/cmd/mgmt/gen/keypair.go index 6441b7ba7a..a4116384cc 100644 --- a/cmd/talosctl/cmd/mgmt/gen/keypair.go +++ b/cmd/talosctl/cmd/mgmt/gen/keypair.go @@ -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) } diff --git a/cmd/talosctl/cmd/mgmt/gen/secrets.go b/cmd/talosctl/cmd/mgmt/gen/secrets.go index 6697e84d04..0e1486e0eb 100644 --- a/cmd/talosctl/cmd/mgmt/gen/secrets.go +++ b/cmd/talosctl/cmd/mgmt/gen/secrets.go @@ -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() { diff --git a/cmd/talosctl/cmd/talos/apply-config.go b/cmd/talosctl/cmd/talos/apply-config.go index 3b1c75c54c..e1baaa3dbb 100644 --- a/cmd/talosctl/cmd/talos/apply-config.go +++ b/cmd/talosctl/cmd/talos/apply-config.go @@ -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) } diff --git a/cmd/talosctl/cmd/talos/config.go b/cmd/talosctl/cmd/talos/config.go index d59053d363..f01caf90ec 100644 --- a/cmd/talosctl/cmd/talos/config.go +++ b/cmd/talosctl/cmd/talos/config.go @@ -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) } diff --git a/cmd/talosctl/cmd/talos/get.go b/cmd/talosctl/cmd/talos/get.go index 70e86e73d8..eea80a3beb 100644 --- a/cmd/talosctl/cmd/talos/get.go +++ b/cmd/talosctl/cmd/talos/get.go @@ -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 diff --git a/cmd/talosctl/cmd/talos/kubeconfig.go b/cmd/talosctl/cmd/talos/kubeconfig.go index 15c14e7bf1..86f65eaea1 100644 --- a/cmd/talosctl/cmd/talos/kubeconfig.go +++ b/cmd/talosctl/cmd/talos/kubeconfig.go @@ -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) }) }, } diff --git a/cmd/talosctl/cmd/talos/pcap.go b/cmd/talosctl/cmd/talos/pcap.go index 1875588a3c..761a6ec46f 100644 --- a/cmd/talosctl/cmd/talos/pcap.go +++ b/cmd/talosctl/cmd/talos/pcap.go @@ -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) diff --git a/cmd/talosctl/pkg/talos/helpers/archive.go b/cmd/talosctl/pkg/talos/helpers/archive.go index 4e0db24d56..b33919d908 100644 --- a/cmd/talosctl/pkg/talos/helpers/archive.go +++ b/cmd/talosctl/pkg/talos/helpers/archive.go @@ -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) } } diff --git a/cmd/talosctl/pkg/talos/helpers/resources.go b/cmd/talosctl/pkg/talos/helpers/resources.go index b3ffbebeac..8e001497e9 100644 --- a/cmd/talosctl/pkg/talos/helpers/resources.go +++ b/cmd/talosctl/pkg/talos/helpers/resources.go @@ -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 { diff --git a/go.mod b/go.mod index a8740ee79f..0a905ec2b7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/talos-systems/talos -go 1.18 +go 1.19 replace ( // Use nested module. diff --git a/go.work b/go.work index a14797b27f..1350d80cb8 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.18 +go 1.19 use ( . diff --git a/go.work.sum b/go.work.sum index da9d273784..1c4c3dc6b1 100644 --- a/go.work.sum +++ b/go.work.sum @@ -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= diff --git a/hack/cloud-image-uploader/go.mod b/hack/cloud-image-uploader/go.mod index 99ec4e312e..92f41e9492 100644 --- a/hack/cloud-image-uploader/go.mod +++ b/hack/cloud-image-uploader/go.mod @@ -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 diff --git a/hack/docgen/go.mod b/hack/docgen/go.mod index d22a3adb44..b8a44a4e95 100644 --- a/hack/docgen/go.mod +++ b/hack/docgen/go.mod @@ -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 diff --git a/hack/docgen/main.go b/hack/docgen/main.go index cdd377a6c8..be43b03938 100644 --- a/hack/docgen/main.go +++ b/hack/docgen/main.go @@ -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 } diff --git a/hack/gotagsrewrite/go.mod b/hack/gotagsrewrite/go.mod index 4419baff78..b4e7dbe497 100644 --- a/hack/gotagsrewrite/go.mod +++ b/hack/gotagsrewrite/go.mod @@ -1,6 +1,6 @@ module github.com/talos-systems/gotagsrewrite -go 1.18 +go 1.19 require ( github.com/fatih/structtag v1.2.0 diff --git a/hack/release.toml b/hack/release.toml index fe3d5cd5df..d66620996a 100644 --- a/hack/release.toml +++ b/hack/release.toml @@ -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] diff --git a/internal/app/apid/pkg/backend/apid.go b/internal/app/apid/pkg/backend/apid.go index 533c5f75af..50d48154d8 100644 --- a/internal/app/apid/pkg/backend/apid.go +++ b/internal/app/apid/pkg/backend/apid.go @@ -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; -// -// } +// message SomeReply { +// common.Metadata metadata = 1; +// +// } // // 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. diff --git a/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go b/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go index 7ab5b7c720..1946e4fb8f 100644 --- a/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go +++ b/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go @@ -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 { diff --git a/internal/app/machined/internal/server/v1alpha1/v1alpha1_time_test.go b/internal/app/machined/internal/server/v1alpha1/v1alpha1_time_test.go index 05ce212648..6fbf679f7f 100644 --- a/internal/app/machined/internal/server/v1alpha1/v1alpha1_time_test.go +++ b/internal/app/machined/internal/server/v1alpha1/v1alpha1_time_test.go @@ -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 } diff --git a/internal/app/machined/pkg/adapters/kubespan/peer_status.go b/internal/app/machined/pkg/adapters/kubespan/peer_status.go index e4243d92ba..ce5bccbfe1 100644 --- a/internal/app/machined/pkg/adapters/kubespan/peer_status.go +++ b/internal/app/machined/pkg/adapters/kubespan/peer_status.go @@ -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) diff --git a/internal/app/machined/pkg/controllers/k8s/extra_manifest.go b/internal/app/machined/pkg/controllers/k8s/extra_manifest.go index 46ed39f6eb..6414f25a3f 100644 --- a/internal/app/machined/pkg/controllers/k8s/extra_manifest.go +++ b/internal/app/machined/pkg/controllers/k8s/extra_manifest.go @@ -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 } diff --git a/internal/app/machined/pkg/controllers/k8s/kubelet_service.go b/internal/app/machined/pkg/controllers/k8s/kubelet_service.go index 6615af7cb8..01cc3386f3 100644 --- a/internal/app/machined/pkg/controllers/k8s/kubelet_service.go +++ b/internal/app/machined/pkg/controllers/k8s/kubelet_service.go @@ -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. diff --git a/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod_controller.go b/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod_controller.go index a0c1166b4a..17b1a0f1ad 100644 --- a/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod_controller.go +++ b/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod_controller.go @@ -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 { diff --git a/internal/app/machined/pkg/controllers/k8s/render_config_static_pods.go b/internal/app/machined/pkg/controllers/k8s/render_config_static_pods.go index 35e1190368..a63ca95044 100644 --- a/internal/app/machined/pkg/controllers/k8s/render_config_static_pods.go +++ b/internal/app/machined/pkg/controllers/k8s/render_config_static_pods.go @@ -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) } diff --git a/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go b/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go index 1bc42910ba..1a1917fc01 100644 --- a/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go +++ b/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go @@ -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) } diff --git a/internal/app/machined/pkg/controllers/network/cmdline.go b/internal/app/machined/pkg/controllers/network/cmdline.go index e0bea7a1e6..47bd942812 100644 --- a/internal/app/machined/pkg/controllers/network/cmdline.go +++ b/internal/app/machined/pkg/controllers/network/cmdline.go @@ -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 diff --git a/internal/app/machined/pkg/controllers/network/link_spec.go b/internal/app/machined/pkg/controllers/network/link_spec.go index 76f7810ddc..c60a37a5b2 100644 --- a/internal/app/machined/pkg/controllers/network/link_spec.go +++ b/internal/app/machined/pkg/controllers/network/link_spec.go @@ -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. // diff --git a/internal/app/machined/pkg/controllers/network/network.go b/internal/app/machined/pkg/controllers/network/network.go index 4def0cc808..8ad6560981 100644 --- a/internal/app/machined/pkg/controllers/network/network.go +++ b/internal/app/machined/pkg/controllers/network/network.go @@ -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 diff --git a/internal/app/machined/pkg/controllers/runtime/kernel_param_spec.go b/internal/app/machined/pkg/controllers/runtime/kernel_param_spec.go index 8620993b01..228121b594 100644 --- a/internal/app/machined/pkg/controllers/runtime/kernel_param_spec.go +++ b/internal/app/machined/pkg/controllers/runtime/kernel_param_spec.go @@ -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 { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go index 3edb3d5825..c611ca51b9 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go b/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go index 4b848f0f76..774183be36 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go @@ -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"), diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go b/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go index 7c6df20194..4ecc54d350 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go index 04ae5e5dbd..10deb73da3 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go index 0634a2b8fd..309ead7089 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go index 89a588c4cc..9a9d137d45 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go index d8b5c322be..cbdf4c1bf9 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go index aa41e255a1..1e08f1d5e6 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go @@ -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. diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/talos/talos.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/talos/talos.go index f2d8ff52e0..03c9223661 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/talos/talos.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/talos/talos.go @@ -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 { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/decode.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/decode.go index fd0b70f29e..2655f3288f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/decode.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/decode.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/encode.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/encode.go index fcaeaa98b0..a6b32e5ce2 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/encode.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/encode.go @@ -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. diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub_test.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub_test.go index 7a984a30fa..08aab55c70 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub_test.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/grub_test.go @@ -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)) } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/install.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/install.go index 2c7e526840..35b3f90456 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/install.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/install.go @@ -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 { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go index 90a170285c..49ce691853 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go @@ -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) { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/register.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/register.go index 9f84cde90f..3fd6c523f0 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/register.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/register.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go index 2ee6921763..7cf3265a63 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go index bffc51737d..c467f5211c 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go @@ -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()) } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go index 45f55c98b2..09668c552e 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go @@ -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) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/metadata.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/metadata.go index bbb8f60185..da4317a411 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/metadata.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/metadata.go @@ -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) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go index 43799c9551..80959d6a4b 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go @@ -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{} diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go index 913e0e615f..56e5b67972 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go @@ -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 diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go index aae469529e..510b73d133 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go @@ -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 } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_events.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_events.go index 36accec6bc..68a445148f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_events.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_events.go @@ -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. diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go index 75e4632717..83a3143072 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go @@ -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 } diff --git a/internal/app/machined/pkg/system/runner/containerd/containerd_test.go b/internal/app/machined/pkg/system/runner/containerd/containerd_test.go index a93758a501..48b205be44 100644 --- a/internal/app/machined/pkg/system/runner/containerd/containerd_test.go +++ b/internal/app/machined/pkg/system/runner/containerd/containerd_test.go @@ -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) diff --git a/internal/app/machined/pkg/system/runner/goroutine/goroutine_test.go b/internal/app/machined/pkg/system/runner/goroutine/goroutine_test.go index 9d827d38b6..49b08e0b35 100644 --- a/internal/app/machined/pkg/system/runner/goroutine/goroutine_test.go +++ b/internal/app/machined/pkg/system/runner/goroutine/goroutine_test.go @@ -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) diff --git a/internal/app/machined/pkg/system/runner/process/process_test.go b/internal/app/machined/pkg/system/runner/process/process_test.go index f3dd5cda8f..5329c878bd 100644 --- a/internal/app/machined/pkg/system/runner/process/process_test.go +++ b/internal/app/machined/pkg/system/runner/process/process_test.go @@ -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 diff --git a/internal/app/machined/pkg/system/runner/restart/restart.go b/internal/app/machined/pkg/system/runner/restart/restart.go index 24ac841814..2d888a689f 100644 --- a/internal/app/machined/pkg/system/runner/restart/restart.go +++ b/internal/app/machined/pkg/system/runner/restart/restart.go @@ -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) diff --git a/internal/app/machined/pkg/system/service_runner.go b/internal/app/machined/pkg/system/service_runner.go index 9a824cde86..678acd5ada 100644 --- a/internal/app/machined/pkg/system/service_runner.go +++ b/internal/app/machined/pkg/system/service_runner.go @@ -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() { diff --git a/internal/app/machined/pkg/system/services/utils.go b/internal/app/machined/pkg/system/services/utils.go index 14adc041fe..8d71c3c426 100644 --- a/internal/app/machined/pkg/system/services/utils.go +++ b/internal/app/machined/pkg/system/services/utils.go @@ -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) } diff --git a/internal/app/machined/pkg/system/system.go b/internal/app/machined/pkg/system/system.go index 9ec9380108..0fa96c7015 100644 --- a/internal/app/machined/pkg/system/system.go +++ b/internal/app/machined/pkg/system/system.go @@ -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() { diff --git a/internal/integration/api/apply-config.go b/internal/integration/api/apply-config.go index a34eba3e3d..4cd7797bf1 100644 --- a/internal/integration/api/apply-config.go +++ b/internal/integration/api/apply-config.go @@ -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) diff --git a/internal/integration/api/dmesg.go b/internal/integration/api/dmesg.go index 84ed2a596e..c6e6ead08f 100644 --- a/internal/integration/api/dmesg.go +++ b/internal/integration/api/dmesg.go @@ -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) diff --git a/internal/integration/api/logs.go b/internal/integration/api/logs.go index 643cd9a9f5..4a4f61e537 100644 --- a/internal/integration/api/logs.go +++ b/internal/integration/api/logs.go @@ -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 diff --git a/internal/integration/base/api.go b/internal/integration/base/api.go index e4330b8062..52aaa5c1d8 100644 --- a/internal/integration/base/api.go +++ b/internal/integration/base/api.go @@ -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 } diff --git a/internal/pkg/encryption/encryption.go b/internal/pkg/encryption/encryption.go index 15f003235e..0fc412f71e 100644 --- a/internal/pkg/encryption/encryption.go +++ b/internal/pkg/encryption/encryption.go @@ -84,6 +84,7 @@ type Handler struct { } // Open encrypted partition. +// //nolint:gocyclo func (h *Handler) Open() (string, error) { partPath, err := h.partition.Path() diff --git a/internal/pkg/mount/mount_test.go b/internal/pkg/mount/mount_test.go index eb974ee72a..367457b2c3 100644 --- a/internal/pkg/mount/mount_test.go +++ b/internal/pkg/mount/mount_test.go @@ -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)) diff --git a/internal/pkg/mount/system.go b/internal/pkg/mount/system.go index 88e2751d11..e02288530b 100644 --- a/internal/pkg/mount/system.go +++ b/internal/pkg/mount/system.go @@ -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 diff --git a/internal/pkg/pci/sysfs.go b/internal/pkg/pci/sysfs.go index 3b55429c75..a07f27a140 100644 --- a/internal/pkg/pci/sysfs.go +++ b/internal/pkg/pci/sysfs.go @@ -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 } diff --git a/internal/pkg/tui/components/form.go b/internal/pkg/tui/components/form.go index da4b7f1593..e8a5e46aa5 100644 --- a/internal/pkg/tui/components/form.go +++ b/internal/pkg/tui/components/form.go @@ -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{} diff --git a/internal/pkg/tui/installer/state.go b/internal/pkg/tui/installer/state.go index 1a9c377fb9..7719555c22 100644 --- a/internal/pkg/tui/installer/state.go +++ b/internal/pkg/tui/installer/state.go @@ -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{ diff --git a/pkg/archiver/tar_test.go b/pkg/archiver/tar_test.go index 88387b4024..2e5efecc90 100644 --- a/pkg/archiver/tar_test.go +++ b/pkg/archiver/tar_test.go @@ -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) diff --git a/pkg/archiver/walker_test.go b/pkg/archiver/walker_test.go index f7dba963ec..6b63d85f75 100644 --- a/pkg/archiver/walker_test.go +++ b/pkg/archiver/walker_test.go @@ -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) diff --git a/pkg/argsbuilder/argsbuilder_args.go b/pkg/argsbuilder/argsbuilder_args.go index 7621bbe539..aea813d4b5 100644 --- a/pkg/argsbuilder/argsbuilder_args.go +++ b/pkg/argsbuilder/argsbuilder_args.go @@ -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 diff --git a/pkg/circular/circular_test.go b/pkg/circular/circular_test.go index ed8aa61cb6..3af21db808 100644 --- a/pkg/circular/circular_test.go +++ b/pkg/circular/circular_test.go @@ -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) diff --git a/pkg/cli/formatters.go b/pkg/cli/formatters.go index 1e800e4a24..bda69e2dfc 100644 --- a/pkg/cli/formatters.go +++ b/pkg/cli/formatters.go @@ -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) diff --git a/pkg/cluster/bootstrap.go b/pkg/cluster/bootstrap.go index 27c37cfa0d..9a0ea2c826 100644 --- a/pkg/cluster/bootstrap.go +++ b/pkg/cluster/bootstrap.go @@ -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() diff --git a/pkg/cluster/check/etcd.go b/pkg/cluster/check/etcd.go index 0829904103..66ce0b5b0e 100644 --- a/pkg/cluster/check/etcd.go +++ b/pkg/cluster/check/etcd.go @@ -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() diff --git a/pkg/cluster/check/events.go b/pkg/cluster/check/events.go index 10214a1c13..80846fa44d 100644 --- a/pkg/cluster/check/events.go +++ b/pkg/cluster/check/events.go @@ -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() diff --git a/pkg/cluster/check/kubernetes.go b/pkg/cluster/check/kubernetes.go index ddd7c43e7d..59bb733d80 100644 --- a/pkg/cluster/check/kubernetes.go +++ b/pkg/cluster/check/kubernetes.go @@ -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) diff --git a/pkg/cluster/check/service.go b/pkg/cluster/check/service.go index aa54c3f60e..a35c14dd47 100644 --- a/pkg/cluster/check/service.go +++ b/pkg/cluster/check/service.go @@ -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() diff --git a/pkg/cluster/kubernetes/detect.go b/pkg/cluster/kubernetes/detect.go index 66cebcf963..c1d0cf3419 100644 --- a/pkg/cluster/kubernetes/detect.go +++ b/pkg/cluster/kubernetes/detect.go @@ -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) diff --git a/pkg/cluster/sonobuoy/sonobuoy.go b/pkg/cluster/sonobuoy/sonobuoy.go index 2263609a53..8d74aeb6b2 100644 --- a/pkg/cluster/sonobuoy/sonobuoy.go +++ b/pkg/cluster/sonobuoy/sonobuoy.go @@ -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) } diff --git a/pkg/cluster/support.go b/pkg/cluster/support.go index 3b43379382..3fa4d688a9 100644 --- a/pkg/cluster/support.go +++ b/pkg/cluster/support.go @@ -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) { diff --git a/pkg/copy/copy.go b/pkg/copy/copy.go index 2bb84c3fef..ef6f8e915f 100644 --- a/pkg/copy/copy.go +++ b/pkg/copy/copy.go @@ -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 } diff --git a/pkg/download/download.go b/pkg/download/download.go index be3ae5ee24..57af846baa 100644 --- a/pkg/download/download.go +++ b/pkg/download/download.go @@ -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())) } diff --git a/pkg/download/tftp.go b/pkg/download/tftp.go index b5db34d5a3..fde9e383ab 100644 --- a/pkg/download/tftp.go +++ b/pkg/download/tftp.go @@ -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 diff --git a/pkg/kernel/kernel.go b/pkg/kernel/kernel.go index 63a2c89b81..46b9d3ef26 100644 --- a/pkg/kernel/kernel.go +++ b/pkg/kernel/kernel.go @@ -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. diff --git a/pkg/kubernetes/kubelet/kubelet.go b/pkg/kubernetes/kubelet/kubelet.go index 2cb0aeeb30..7243f82ee2 100644 --- a/pkg/kubernetes/kubelet/kubelet.go +++ b/pkg/kubernetes/kubelet/kubelet.go @@ -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 { diff --git a/pkg/machinery/client/config/config.go b/pkg/machinery/client/config/config.go index 296a14642d..78c13da7d7 100644 --- a/pkg/machinery/client/config/config.go +++ b/pkg/machinery/client/config/config.go @@ -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 } diff --git a/pkg/machinery/config/configloader/configloader.go b/pkg/machinery/config/configloader/configloader.go index 099bf776cf..1807e5b506 100644 --- a/pkg/machinery/config/configloader/configloader.go +++ b/pkg/machinery/config/configloader/configloader.go @@ -10,7 +10,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "github.com/talos-systems/talos/pkg/machinery/config" @@ -75,5 +74,5 @@ func NewFromBytes(source []byte) (config.Provider, error) { // fromFile is a convenience function that reads the config from disk. func fromFile(p string) ([]byte, error) { - return ioutil.ReadFile(p) + return os.ReadFile(p) } diff --git a/pkg/machinery/config/decoder/decoder_test.go b/pkg/machinery/config/decoder/decoder_test.go index 2c4fd09890..279a37377d 100644 --- a/pkg/machinery/config/decoder/decoder_test.go +++ b/pkg/machinery/config/decoder/decoder_test.go @@ -5,7 +5,7 @@ package decoder_test import ( - "io/ioutil" + "os" "path/filepath" "testing" @@ -331,7 +331,7 @@ func TestDecoderV1Alpha1Config(t *testing.T) { t.Run(file, func(t *testing.T) { t.Parallel() - contents, err := ioutil.ReadFile(file) + contents, err := os.ReadFile(file) require.NoError(t, err) d := decoder.NewDecoder(contents) @@ -345,7 +345,7 @@ func TestDecoderV1Alpha1Config(t *testing.T) { func BenchmarkDecoderV1Alpha1Config(b *testing.B) { b.ReportAllocs() - contents, err := ioutil.ReadFile("testdata/controlplane.yaml") + contents, err := os.ReadFile("testdata/controlplane.yaml") require.NoError(b, err) for i := 0; i < b.N; i++ { diff --git a/pkg/machinery/config/encoder/encoder.go b/pkg/machinery/config/encoder/encoder.go index 4aaadc1c32..80c8f6f34a 100644 --- a/pkg/machinery/config/encoder/encoder.go +++ b/pkg/machinery/config/encoder/encoder.go @@ -41,6 +41,7 @@ func (e *Encoder) Marshal() (*yaml.Node, error) { } // Encode converts value to yaml. +// //nolint:gocyclo func (e *Encoder) Encode() ([]byte, error) { if e.options.Comments == CommentsDisabled { diff --git a/pkg/machinery/config/merge/merge.go b/pkg/machinery/config/merge/merge.go index 18f800a72c..5f0b16ffa7 100644 --- a/pkg/machinery/config/merge/merge.go +++ b/pkg/machinery/config/merge/merge.go @@ -18,15 +18,15 @@ import ( // It is specifically fine-tuned to merge Talos machine configuration. // // Rules: -// - if it is a simple value (int, float, string, etc.), it's merged into the left unless it's zero value, but boolean false is always merged. -// - if it is a pointer, merged dereferencing the pointer unless the right is nil -// - if it is a slice, merged by concatenating the right to the left. -// - if the `merge:"replace"` struct tag is defined, a slice is replaced with the value of the right (unless it's zero value.) -// - slices of `[]byte` are always replaced -// - if it is a map, for each key value is merged recursively. -// - if it is a struct, merge is performed for each field of the struct. -// - if the type implements 'merger' interface, Merge function is called to handle the merge process. -// - merger interface should be implemented on the pointer to the type. +// - if it is a simple value (int, float, string, etc.), it's merged into the left unless it's zero value, but boolean false is always merged. +// - if it is a pointer, merged dereferencing the pointer unless the right is nil +// - if it is a slice, merged by concatenating the right to the left. +// - if the `merge:"replace"` struct tag is defined, a slice is replaced with the value of the right (unless it's zero value.) +// - slices of `[]byte` are always replaced +// - if it is a map, for each key value is merged recursively. +// - if it is a struct, merge is performed for each field of the struct. +// - if the type implements 'merger' interface, Merge function is called to handle the merge process. +// - merger interface should be implemented on the pointer to the type. func Merge(left, right interface{}) error { return merge(reflect.ValueOf(left), reflect.ValueOf(right), false) } diff --git a/pkg/machinery/config/types/v1alpha1/bundle/bundle.go b/pkg/machinery/config/types/v1alpha1/bundle/bundle.go index 7b15ed0e89..5f85983de1 100644 --- a/pkg/machinery/config/types/v1alpha1/bundle/bundle.go +++ b/pkg/machinery/config/types/v1alpha1/bundle/bundle.go @@ -6,7 +6,6 @@ package bundle import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -20,6 +19,7 @@ import ( ) // NewConfigBundle returns a new bundle. +// //nolint:gocyclo,cyclop func NewConfigBundle(opts ...Option) (*ConfigBundle, error) { options := DefaultOptions() @@ -40,7 +40,7 @@ func NewConfigBundle(opts ...Option) (*ConfigBundle, error) { // Pull existing machine configs of each type for _, configType := range []machine.Type{machine.TypeInit, machine.TypeControlPlane, machine.TypeWorker} { - data, err := ioutil.ReadFile(filepath.Join(options.ExistingConfigs, strings.ToLower(configType.String())+".yaml")) + data, err := os.ReadFile(filepath.Join(options.ExistingConfigs, strings.ToLower(configType.String())+".yaml")) if err != nil { if configType == machine.TypeInit && os.IsNotExist(err) { continue diff --git a/pkg/machinery/config/types/v1alpha1/bundle/v1alpha1_configurator_bundle.go b/pkg/machinery/config/types/v1alpha1/bundle/v1alpha1_configurator_bundle.go index 73933735b0..5b9ac374f0 100644 --- a/pkg/machinery/config/types/v1alpha1/bundle/v1alpha1_configurator_bundle.go +++ b/pkg/machinery/config/types/v1alpha1/bundle/v1alpha1_configurator_bundle.go @@ -6,7 +6,7 @@ package bundle import ( "fmt" - "io/ioutil" + "os" "path/filepath" "strings" @@ -81,7 +81,7 @@ func (c *ConfigBundle) Write(outputDir string, commentsFlags encoder.CommentsFla return fmt.Errorf("unexpected machine type %v", t) } - if err = ioutil.WriteFile(fullFilePath, []byte(configString), 0o644); err != nil { + if err = os.WriteFile(fullFilePath, []byte(configString), 0o644); err != nil { return err } diff --git a/pkg/machinery/config/types/v1alpha1/generate/options.go b/pkg/machinery/config/types/v1alpha1/generate/options.go index 17d9868cf1..3ef80d218f 100644 --- a/pkg/machinery/config/types/v1alpha1/generate/options.go +++ b/pkg/machinery/config/types/v1alpha1/generate/options.go @@ -5,7 +5,7 @@ package generate import ( - "io/ioutil" + "os" "github.com/siderolabs/go-pointer" "gopkg.in/yaml.v3" @@ -244,7 +244,7 @@ func WithSysctls(params map[string]string) GenOption { // WithSecrets reads secrets from a provided file. func WithSecrets(file string) GenOption { return func(o *GenOptions) error { - yamlBytes, err := ioutil.ReadFile(file) + yamlBytes, err := os.ReadFile(file) if err != nil { return err } diff --git a/pkg/machinery/config/types/v1alpha1/v1alpha1_provider.go b/pkg/machinery/config/types/v1alpha1/v1alpha1_provider.go index 8f8d8aed6f..aa04b96216 100644 --- a/pkg/machinery/config/types/v1alpha1/v1alpha1_provider.go +++ b/pkg/machinery/config/types/v1alpha1/v1alpha1_provider.go @@ -1032,6 +1032,7 @@ func (i *InstallConfig) Disk() (string, error) { } // DiskMatchers implements the config.Provider interface. +// //nolint:gocyclo func (i *InstallConfig) DiskMatchers() []disk.Matcher { if i.InstallDiskSelector != nil { diff --git a/pkg/machinery/config/types/v1alpha1/v1alpha1_types.go b/pkg/machinery/config/types/v1alpha1/v1alpha1_types.go index 9c96cfb6c5..2290e871f3 100644 --- a/pkg/machinery/config/types/v1alpha1/v1alpha1_types.go +++ b/pkg/machinery/config/types/v1alpha1/v1alpha1_types.go @@ -613,8 +613,8 @@ metadata: // Config defines the v1alpha1 configuration file. // -// examples: -// - value: configExample +// examples: +// - value: configExample type Config struct { // description: | // Indicates the schema used to decode the contents. @@ -650,8 +650,8 @@ type Config struct { // MachineConfig represents the machine-specific config values. // -// examples: -// - value: machineConfigExample +// examples: +// - value: machineConfigExample type MachineConfig struct { // description: | // Defines the role of the machine within the cluster. @@ -842,8 +842,8 @@ type MachineSeccompProfile struct { // ClusterConfig represents the cluster-wide config values. // -// examples: -// - value: clusterConfigExample +// examples: +// - value: clusterConfigExample type ClusterConfig struct { // description: | // Globally unique identifier for this cluster (base64 encoded random 32 bytes). @@ -1297,6 +1297,7 @@ func (m *InstallDiskSizeMatcher) Matcher(d *disk.Disk) bool { } // InstallDiskSizeMatchData contains data for comparison - Op and Size. +// //docgen:nodoc type InstallDiskSizeMatchData struct { Op string diff --git a/pkg/machinery/config/types/v1alpha1/v1alpha1_types_doc.go b/pkg/machinery/config/types/v1alpha1/v1alpha1_types_doc.go index 8f5ce5de9c..b873c47a64 100644 --- a/pkg/machinery/config/types/v1alpha1/v1alpha1_types_doc.go +++ b/pkg/machinery/config/types/v1alpha1/v1alpha1_types_doc.go @@ -2922,7 +2922,7 @@ func (_ KernelModuleConfig) Doc() *encoder.Doc { // GetConfigurationDoc returns documentation for the file ./v1alpha1_types_doc.go. func GetConfigurationDoc() *encoder.FileDoc { return &encoder.FileDoc{ - Name: "Configuration", + Name: "Configuration", Description: "Package v1alpha1 configuration file contains all the options available for configuring a machine.\n\nTo generate a set of basic configuration files, run:\n\n talosctl gen config --version v1alpha1 \n\nThis will generate a machine config for each node type, and a talosconfig for the CLI.\n", Structs: []*encoder.Doc{ &ConfigDoc, diff --git a/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go b/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go index 705e1d0943..a91ae5714f 100644 --- a/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go +++ b/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go @@ -65,6 +65,7 @@ var ( type NetworkDeviceCheck func(*Device, map[string]string) ([]string, error) // Validate implements the config.Provider interface. +// //nolint:gocyclo,cyclop func (c *Config) Validate(mode config.RuntimeMode, options ...config.ValidationOption) ([]string, error) { var ( @@ -460,6 +461,7 @@ func ValidateNetworkDevices(d *Device, pairedInterfaces map[string]string, check } // CheckDeviceInterface ensures that the interface has been specified. +// //nolint:gocyclo func CheckDeviceInterface(d *Device, _ map[string]string) ([]string, error) { var result *multierror.Error diff --git a/pkg/machinery/constants/constants.go b/pkg/machinery/constants/constants.go index e5005ec28c..dfa74d7a01 100644 --- a/pkg/machinery/constants/constants.go +++ b/pkg/machinery/constants/constants.go @@ -13,7 +13,7 @@ import ( const ( // DefaultKernelVersion is the default Linux kernel version. - DefaultKernelVersion = "5.15.57-talos" + DefaultKernelVersion = "5.15.58-talos" // KernelParamConfig is the kernel parameter name for specifying the URL. // to the config. @@ -697,7 +697,7 @@ const ( DBusClientSocketPath = "/run/dbus/system_bus_socket" // GoVersion is the version of Go compiler this release was built with. - GoVersion = "go1.18.4" + GoVersion = "go1.19" // KubernetesTalosAPIServiceName is the name of the Kubernetes service to access Talos API. KubernetesTalosAPIServiceName = "talos" @@ -716,6 +716,7 @@ const ( ) // See https://linux.die.net/man/3/klogctl +// //nolint:stylecheck,revive const ( // SYSLOG_ACTION_SIZE_BUFFER is a named type argument to klogctl. diff --git a/pkg/machinery/extensions/config.go b/pkg/machinery/extensions/config.go index 7bb26f3ef5..f891aba506 100644 --- a/pkg/machinery/extensions/config.go +++ b/pkg/machinery/extensions/config.go @@ -19,6 +19,7 @@ type Config struct { } // Layer defines overlay mount layer. +// //gotagsrewrite:gen type Layer struct { Image string `yaml:"image" protobuf:"1"` diff --git a/pkg/machinery/extensions/metadata.go b/pkg/machinery/extensions/metadata.go index 6bd648461d..8fa30da6fe 100644 --- a/pkg/machinery/extensions/metadata.go +++ b/pkg/machinery/extensions/metadata.go @@ -11,6 +11,7 @@ type Manifest struct { } // Metadata describes base extension metadata. +// //gotagsrewrite:gen type Metadata struct { Name string `yaml:"name" protobuf:"1"` diff --git a/pkg/machinery/extensions/services/restartkind_enumer.go b/pkg/machinery/extensions/services/restartkind_enumer.go index f4022812d7..5ccb0b17fb 100644 --- a/pkg/machinery/extensions/services/restartkind_enumer.go +++ b/pkg/machinery/extensions/services/restartkind_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=RestartKind -linecomment -text"; DO NOT EDIT. -// package services import ( diff --git a/pkg/machinery/gendata/data/extras b/pkg/machinery/gendata/data/extras index 2d51cecb0f..37a9fc8db1 100644 --- a/pkg/machinery/gendata/data/extras +++ b/pkg/machinery/gendata/data/extras @@ -1 +1 @@ -v1.2.0-alpha.0-1-g17a319f \ No newline at end of file +v1.2.0-alpha.0-2-gda35a63 \ No newline at end of file diff --git a/pkg/machinery/gendata/data/pkgs b/pkg/machinery/gendata/data/pkgs index 597f744d19..a9c5d9322c 100644 --- a/pkg/machinery/gendata/data/pkgs +++ b/pkg/machinery/gendata/data/pkgs @@ -1 +1 @@ -v1.2.0-alpha.0-23-gdcc0311 \ No newline at end of file +v1.2.0-alpha.0-25-g6feece4 \ No newline at end of file diff --git a/pkg/machinery/go.mod b/pkg/machinery/go.mod index faa886b517..ef62d6c4ed 100644 --- a/pkg/machinery/go.mod +++ b/pkg/machinery/go.mod @@ -1,6 +1,6 @@ module github.com/talos-systems/talos/pkg/machinery -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 diff --git a/pkg/machinery/nethelpers/addressflag_enumer.go b/pkg/machinery/nethelpers/addressflag_enumer.go index 1e4d11e2d6..74f6ab8704 100644 --- a/pkg/machinery/nethelpers/addressflag_enumer.go +++ b/pkg/machinery/nethelpers/addressflag_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=AddressFlag -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/adselect_enumer.go b/pkg/machinery/nethelpers/adselect_enumer.go index ff00b7bc51..0145ec89ef 100644 --- a/pkg/machinery/nethelpers/adselect_enumer.go +++ b/pkg/machinery/nethelpers/adselect_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=ADSelect -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/arpalltargets_enumer.go b/pkg/machinery/nethelpers/arpalltargets_enumer.go index 26b4704556..6dfdec70ce 100644 --- a/pkg/machinery/nethelpers/arpalltargets_enumer.go +++ b/pkg/machinery/nethelpers/arpalltargets_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=ARPAllTargets -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/arpvalidate_enumer.go b/pkg/machinery/nethelpers/arpvalidate_enumer.go index 245910c6ea..9b50bda6ed 100644 --- a/pkg/machinery/nethelpers/arpvalidate_enumer.go +++ b/pkg/machinery/nethelpers/arpvalidate_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=ARPValidate -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/bondmode_enumer.go b/pkg/machinery/nethelpers/bondmode_enumer.go index f646458908..3d5f493fd7 100644 --- a/pkg/machinery/nethelpers/bondmode_enumer.go +++ b/pkg/machinery/nethelpers/bondmode_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=BondMode -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go b/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go index db050e1efc..12e179d31d 100644 --- a/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go +++ b/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=BondXmitHashPolicy -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/device.go b/pkg/machinery/nethelpers/device.go index aabce630fa..04fa34bc8f 100644 --- a/pkg/machinery/nethelpers/device.go +++ b/pkg/machinery/nethelpers/device.go @@ -6,7 +6,7 @@ package nethelpers import ( "bytes" - "io/ioutil" + "io" "os" "path/filepath" "strings" @@ -20,6 +20,7 @@ type DeviceInfo struct { } // GetDeviceInfo get additional device information by reading /sys/ directory. +// //nolint:gocyclo func GetDeviceInfo(deviceName string) (*DeviceInfo, error) { path := filepath.Join("/sys/class/net/", deviceName, "/device/") @@ -30,7 +31,7 @@ func GetDeviceInfo(deviceName string) (*DeviceInfo, error) { return "", err } - res, err := ioutil.ReadAll(f) + res, err := io.ReadAll(f) if err != nil { return "", err } diff --git a/pkg/machinery/nethelpers/duplex_enumer.go b/pkg/machinery/nethelpers/duplex_enumer.go index f393e2b779..78327a25f8 100644 --- a/pkg/machinery/nethelpers/duplex_enumer.go +++ b/pkg/machinery/nethelpers/duplex_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Duplex -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/failovermac_enumer.go b/pkg/machinery/nethelpers/failovermac_enumer.go index 102cd5d10d..a450905f50 100644 --- a/pkg/machinery/nethelpers/failovermac_enumer.go +++ b/pkg/machinery/nethelpers/failovermac_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=FailOverMAC -linecomment"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/family_enumer.go b/pkg/machinery/nethelpers/family_enumer.go index e8c1e0f590..4cd0bf9705 100644 --- a/pkg/machinery/nethelpers/family_enumer.go +++ b/pkg/machinery/nethelpers/family_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Family -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/lacprate_enumer.go b/pkg/machinery/nethelpers/lacprate_enumer.go index b716e5e00f..782f04ab2d 100644 --- a/pkg/machinery/nethelpers/lacprate_enumer.go +++ b/pkg/machinery/nethelpers/lacprate_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=LACPRate -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/linkflag_enumer.go b/pkg/machinery/nethelpers/linkflag_enumer.go index bf725017d4..b8190e72ad 100644 --- a/pkg/machinery/nethelpers/linkflag_enumer.go +++ b/pkg/machinery/nethelpers/linkflag_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=LinkFlag -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/linktype_enumer.go b/pkg/machinery/nethelpers/linktype_enumer.go index b824d96f00..15075a44d3 100644 --- a/pkg/machinery/nethelpers/linktype_enumer.go +++ b/pkg/machinery/nethelpers/linktype_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=LinkType -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/operationalstate_enumer.go b/pkg/machinery/nethelpers/operationalstate_enumer.go index 6943030db3..b919872c3c 100644 --- a/pkg/machinery/nethelpers/operationalstate_enumer.go +++ b/pkg/machinery/nethelpers/operationalstate_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=OperationalState -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/port_enumer.go b/pkg/machinery/nethelpers/port_enumer.go index 71032d8a14..093fe987d5 100644 --- a/pkg/machinery/nethelpers/port_enumer.go +++ b/pkg/machinery/nethelpers/port_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Port -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/primaryreselect_enumer.go b/pkg/machinery/nethelpers/primaryreselect_enumer.go index 5d8dfeb9d6..f60ed016b6 100644 --- a/pkg/machinery/nethelpers/primaryreselect_enumer.go +++ b/pkg/machinery/nethelpers/primaryreselect_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=PrimaryReselect -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/routeflag_enumer.go b/pkg/machinery/nethelpers/routeflag_enumer.go index 1d3b5d8f2c..89cfcf6c9f 100644 --- a/pkg/machinery/nethelpers/routeflag_enumer.go +++ b/pkg/machinery/nethelpers/routeflag_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=RouteFlag -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/routeprotocol_enumer.go b/pkg/machinery/nethelpers/routeprotocol_enumer.go index 871a03b41e..b920cdd511 100644 --- a/pkg/machinery/nethelpers/routeprotocol_enumer.go +++ b/pkg/machinery/nethelpers/routeprotocol_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=RouteProtocol -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/routetype_enumer.go b/pkg/machinery/nethelpers/routetype_enumer.go index 5c68ae90ee..27b8a8c748 100644 --- a/pkg/machinery/nethelpers/routetype_enumer.go +++ b/pkg/machinery/nethelpers/routetype_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=RouteType -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/routingtable_enumer.go b/pkg/machinery/nethelpers/routingtable_enumer.go index 728034d737..b241226c6e 100644 --- a/pkg/machinery/nethelpers/routingtable_enumer.go +++ b/pkg/machinery/nethelpers/routingtable_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=RoutingTable -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/scope_enumer.go b/pkg/machinery/nethelpers/scope_enumer.go index 8de2ecfe07..492634aaa2 100644 --- a/pkg/machinery/nethelpers/scope_enumer.go +++ b/pkg/machinery/nethelpers/scope_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Scope -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/status_enumer.go b/pkg/machinery/nethelpers/status_enumer.go index 1e8e359092..878f10aa12 100644 --- a/pkg/machinery/nethelpers/status_enumer.go +++ b/pkg/machinery/nethelpers/status_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Status -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/nethelpers/vlanprotocol_enumer.go b/pkg/machinery/nethelpers/vlanprotocol_enumer.go index bd0f7fc4fb..dd326a9aff 100644 --- a/pkg/machinery/nethelpers/vlanprotocol_enumer.go +++ b/pkg/machinery/nethelpers/vlanprotocol_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=VLANProtocol -linecomment -text"; DO NOT EDIT. -// package nethelpers import ( diff --git a/pkg/machinery/resources/cluster/affiliate.go b/pkg/machinery/resources/cluster/affiliate.go index ae2d7b1ed8..516ed0ece8 100644 --- a/pkg/machinery/resources/cluster/affiliate.go +++ b/pkg/machinery/resources/cluster/affiliate.go @@ -66,6 +66,7 @@ func (r AffiliateRD) ResourceDefinition(resource.Metadata, AffiliateSpec) meta.R } // AffiliateSpec describes Affiliate state. +// //gotagsrewrite:gen type AffiliateSpec struct { NodeID string `yaml:"nodeId" protobuf:"1"` diff --git a/pkg/machinery/resources/cluster/config.go b/pkg/machinery/resources/cluster/config.go index c18805c935..054273cef6 100644 --- a/pkg/machinery/resources/cluster/config.go +++ b/pkg/machinery/resources/cluster/config.go @@ -22,6 +22,7 @@ const ConfigID = resource.ID("cluster") type Config = typed.Resource[ConfigSpec, ConfigRD] // ConfigSpec describes KubeSpan configuration. +// //gotagsrewrite:gen type ConfigSpec struct { DiscoveryEnabled bool `yaml:"discoveryEnabled" protobuf:"1"` diff --git a/pkg/machinery/resources/cluster/identity.go b/pkg/machinery/resources/cluster/identity.go index e398d09cd8..4a1a1faac5 100644 --- a/pkg/machinery/resources/cluster/identity.go +++ b/pkg/machinery/resources/cluster/identity.go @@ -23,6 +23,7 @@ type Identity = typed.Resource[IdentitySpec, IdentityRD] // // Note: IdentitySpec is persisted on disk in the STATE partition, // so YAML serialization should be kept backwards compatible. +// //gotagsrewrite:gen type IdentitySpec struct { // NodeID is a random value which is persisted across reboots, diff --git a/pkg/machinery/resources/cluster/member.go b/pkg/machinery/resources/cluster/member.go index e89475b038..58e7b40e26 100644 --- a/pkg/machinery/resources/cluster/member.go +++ b/pkg/machinery/resources/cluster/member.go @@ -22,6 +22,7 @@ const MemberType = resource.Type("Members.cluster.talos.dev") type Member = typed.Resource[MemberSpec, MemberRD] // MemberSpec describes Member state. +// //gotagsrewrite:gen type MemberSpec struct { NodeID string `yaml:"nodeId" protobuf:"1"` diff --git a/pkg/machinery/resources/cri/seccomp_profile.go b/pkg/machinery/resources/cri/seccomp_profile.go index a6f0a4d4f0..aad87e6941 100644 --- a/pkg/machinery/resources/cri/seccomp_profile.go +++ b/pkg/machinery/resources/cri/seccomp_profile.go @@ -20,6 +20,7 @@ const SeccompProfileType = resource.Type("SeccompProfiles.cri.talos.dev") type SeccompProfile = typed.Resource[SeccompProfileSpec, SeccompProfileRD] // SeccompProfileSpec represents the SeccompProfile. +// //gotagsrewrite:gen type SeccompProfileSpec struct { Name string `yaml:"name" protobuf:"1"` diff --git a/pkg/machinery/resources/etcd/pki_status.go b/pkg/machinery/resources/etcd/pki_status.go index 08ffad0e34..46c8992c1b 100644 --- a/pkg/machinery/resources/etcd/pki_status.go +++ b/pkg/machinery/resources/etcd/pki_status.go @@ -20,6 +20,7 @@ const PKIID = resource.ID("etcd") type PKIStatus = typed.Resource[PKIStatusSpec, PKIStatusRD] // PKIStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type PKIStatusSpec struct { Ready bool `yaml:"ready" protobuf:"1"` diff --git a/pkg/machinery/resources/files/etcfile_spec.go b/pkg/machinery/resources/files/etcfile_spec.go index 4403285f43..a21b79aea9 100644 --- a/pkg/machinery/resources/files/etcfile_spec.go +++ b/pkg/machinery/resources/files/etcfile_spec.go @@ -21,6 +21,7 @@ const EtcFileSpecType = resource.Type("EtcFileSpecs.files.talos.dev") type EtcFileSpec = typed.Resource[EtcFileSpecSpec, EtcFileSpecMD] // EtcFileSpecSpec describes status of rendered secrets. +// //gotagsrewrite:gen type EtcFileSpecSpec struct { Contents []byte `yaml:"contents" protobuf:"1"` diff --git a/pkg/machinery/resources/files/etcfile_status.go b/pkg/machinery/resources/files/etcfile_status.go index 2d0ee0a649..dd17789877 100644 --- a/pkg/machinery/resources/files/etcfile_status.go +++ b/pkg/machinery/resources/files/etcfile_status.go @@ -17,6 +17,7 @@ const EtcFileStatusType = resource.Type("EtcFileStatuses.files.talos.dev") type EtcFileStatus = typed.Resource[EtcFileStatusSpec, EtcFileStatusMD] // EtcFileStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type EtcFileStatusSpec struct { SpecVersion string `yaml:"specVersion" protobuf:"1"` diff --git a/pkg/machinery/resources/hardware/memorymodule.go b/pkg/machinery/resources/hardware/memorymodule.go index 1afed03798..c90208b2fa 100644 --- a/pkg/machinery/resources/hardware/memorymodule.go +++ b/pkg/machinery/resources/hardware/memorymodule.go @@ -17,6 +17,7 @@ const MemoryModuleType = resource.Type("MemoryModules.hardware.talos.dev") type MemoryModule = typed.Resource[MemoryModuleSpec, MemoryModuleRD] // MemoryModuleSpec represents a single Memory. +// //gotagsrewrite:gen type MemoryModuleSpec struct { Size uint32 `yaml:"sizeMiB,omitempty" protobuf:"1"` diff --git a/pkg/machinery/resources/hardware/processor.go b/pkg/machinery/resources/hardware/processor.go index 09fb08d4f4..3c455abbb3 100644 --- a/pkg/machinery/resources/hardware/processor.go +++ b/pkg/machinery/resources/hardware/processor.go @@ -17,6 +17,7 @@ const ProcessorType = resource.Type("Processors.hardware.talos.dev") type Processor = typed.Resource[ProcessorSpec, ProcessorRD] // ProcessorSpec represents a single processor. +// //gotagsrewrite:gen type ProcessorSpec struct { Socket string `yaml:"socket,omitempty" protobuf:"1"` diff --git a/pkg/machinery/resources/hardware/system_information.go b/pkg/machinery/resources/hardware/system_information.go index a5c04a82b3..cb14a258ee 100644 --- a/pkg/machinery/resources/hardware/system_information.go +++ b/pkg/machinery/resources/hardware/system_information.go @@ -17,6 +17,7 @@ const SystemInformationType = resource.Type("SystemInformations.hardware.talos.d type SystemInformation = typed.Resource[SystemInformationSpec, SystemInformationRD] // SystemInformationSpec represents the system information obtained from smbios. +// //gotagsrewrite:gen type SystemInformationSpec struct { Manufacturer string `yaml:"manufacturer,omitempty" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/admissioncontrol_config.go b/pkg/machinery/resources/k8s/admissioncontrol_config.go index c08e8b7560..685697a7ae 100644 --- a/pkg/machinery/resources/k8s/admissioncontrol_config.go +++ b/pkg/machinery/resources/k8s/admissioncontrol_config.go @@ -26,6 +26,7 @@ const AdmissionControlConfigID = resource.ID("admission-control") type AdmissionControlConfig = typed.Resource[AdmissionControlConfigSpec, AdmissionControlConfigRD] // AdmissionControlConfigSpec is configuration for kube-apiserver. +// //gotagsrewrite:gen type AdmissionControlConfigSpec struct { Config []AdmissionPluginSpec `yaml:"config" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/apiserver_config.go b/pkg/machinery/resources/k8s/apiserver_config.go index 7d1f774d10..3a2c6ada04 100644 --- a/pkg/machinery/resources/k8s/apiserver_config.go +++ b/pkg/machinery/resources/k8s/apiserver_config.go @@ -23,6 +23,7 @@ const APIServerConfigID = resource.ID(APIServerID) type APIServerConfig = typed.Resource[APIServerConfigSpec, APIServerConfigRD] // ExtraVolume is a configuration of extra volume. +// //gotagsrewrite:gen type ExtraVolume struct { Name string `yaml:"name" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/config_status.go b/pkg/machinery/resources/k8s/config_status.go index 6950afc474..61bb98103f 100644 --- a/pkg/machinery/resources/k8s/config_status.go +++ b/pkg/machinery/resources/k8s/config_status.go @@ -23,6 +23,7 @@ const ConfigStatusStaticPodID = resource.ID("static-pods") type ConfigStatus = typed.Resource[ConfigStatusSpec, ConfigStatusRD] // ConfigStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type ConfigStatusSpec struct { Ready bool `yaml:"ready" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/controllermanager_config.go b/pkg/machinery/resources/k8s/controllermanager_config.go index 404078f890..ce2e2e2675 100644 --- a/pkg/machinery/resources/k8s/controllermanager_config.go +++ b/pkg/machinery/resources/k8s/controllermanager_config.go @@ -23,6 +23,7 @@ const ControllerManagerConfigID = resource.ID(ControllerManagerID) type ControllerManagerConfig = typed.Resource[ControllerManagerConfigSpec, ControllerManagerConfigRD] // ControllerManagerConfigSpec is configuration for kube-controller-manager. +// //gotagsrewrite:gen type ControllerManagerConfigSpec struct { Enabled bool `yaml:"enabled" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/endpoint.go b/pkg/machinery/resources/k8s/endpoint.go index 6887e08041..ba1cce47b1 100644 --- a/pkg/machinery/resources/k8s/endpoint.go +++ b/pkg/machinery/resources/k8s/endpoint.go @@ -28,6 +28,7 @@ const ControlPlaneDiscoveredEndpointsID = resource.ID("discovery") type Endpoint = typed.Resource[EndpointSpec, EndpointRD] // EndpointSpec describes status of rendered secrets. +// //gotagsrewrite:gen type EndpointSpec struct { Addresses []netaddr.IP `yaml:"addresses" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/extramanifests_config.go b/pkg/machinery/resources/k8s/extramanifests_config.go index 4dd047d5d6..da29268e21 100644 --- a/pkg/machinery/resources/k8s/extramanifests_config.go +++ b/pkg/machinery/resources/k8s/extramanifests_config.go @@ -23,6 +23,7 @@ const ExtraManifestsConfigID = resource.ID("extra-manifests") type ExtraManifestsConfig = typed.Resource[ExtraManifestsConfigSpec, ExtraManifestsConfigRD] // ExtraManifestsConfigSpec is configuration for extra bootstrap manifests. +// //gotagsrewrite:gen type ExtraManifestsConfigSpec struct { ExtraManifests []ExtraManifest `yaml:"extraManifests" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/kubelet_config.go b/pkg/machinery/resources/k8s/kubelet_config.go index 858361ef0d..bb22e80194 100644 --- a/pkg/machinery/resources/k8s/kubelet_config.go +++ b/pkg/machinery/resources/k8s/kubelet_config.go @@ -23,6 +23,7 @@ const KubeletID = resource.ID("kubelet") type KubeletConfig = typed.Resource[KubeletConfigSpec, KubeletConfigRD] // KubeletConfigSpec holds the source of kubelet configuration. +// //gotagsrewrite:gen type KubeletConfigSpec struct { Image string `yaml:"image" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/kubelet_spec.go b/pkg/machinery/resources/k8s/kubelet_spec.go index b8bbdefabe..bf11509808 100644 --- a/pkg/machinery/resources/k8s/kubelet_spec.go +++ b/pkg/machinery/resources/k8s/kubelet_spec.go @@ -18,6 +18,7 @@ const KubeletSpecType = resource.Type("KubeletSpecs.kubernetes.talos.dev") type KubeletSpec = typed.Resource[KubeletSpecSpec, KubeletSpecRD] // KubeletSpecSpec holds the source of kubelet configuration. +// //gotagsrewrite:gen type KubeletSpecSpec struct { Image string `yaml:"image" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/manifest.go b/pkg/machinery/resources/k8s/manifest.go index 3639b50d6a..18e2492950 100644 --- a/pkg/machinery/resources/k8s/manifest.go +++ b/pkg/machinery/resources/k8s/manifest.go @@ -17,6 +17,7 @@ const ManifestType = resource.Type("Manifests.kubernetes.talos.dev") type Manifest = typed.Resource[ManifestSpec, ManifestRD] // ManifestSpec holds the Kubernetes resources spec. +// //gotagsrewrite:gen type ManifestSpec struct { Items []map[string]interface{} `protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/manifest_status.go b/pkg/machinery/resources/k8s/manifest_status.go index e2c4495e4d..4be3b2b227 100644 --- a/pkg/machinery/resources/k8s/manifest_status.go +++ b/pkg/machinery/resources/k8s/manifest_status.go @@ -20,6 +20,7 @@ const ManifestStatusID = resource.ID("manifests") type ManifestStatus = typed.Resource[ManifestStatusSpec, ManifestStatusRD] // ManifestStatusSpec describes manifest application status. +// //gotagsrewrite:gen type ManifestStatusSpec struct { ManifestsApplied []string `yaml:"manifestsApplied" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/manifests_config.go b/pkg/machinery/resources/k8s/manifests_config.go index 49ae63e1b4..27892bc6f7 100644 --- a/pkg/machinery/resources/k8s/manifests_config.go +++ b/pkg/machinery/resources/k8s/manifests_config.go @@ -23,6 +23,7 @@ const BootstrapManifestsConfigID = resource.ID("manifests") type BootstrapManifestsConfig = typed.Resource[BootstrapManifestsConfigSpec, BootstrapManifestsConfigRD] // BootstrapManifestsConfigSpec is configuration for bootstrap manifests. +// //gotagsrewrite:gen type BootstrapManifestsConfigSpec struct { Server string `yaml:"string" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/nodeip.go b/pkg/machinery/resources/k8s/nodeip.go index c77b868667..f4125c8b38 100644 --- a/pkg/machinery/resources/k8s/nodeip.go +++ b/pkg/machinery/resources/k8s/nodeip.go @@ -18,6 +18,7 @@ const NodeIPType = resource.Type("NodeIPs.kubernetes.talos.dev") type NodeIP = typed.Resource[NodeIPSpec, NodeIPRD] // NodeIPSpec holds the Node IP specification. +// //gotagsrewrite:gen type NodeIPSpec struct { Addresses []netaddr.IP `yaml:"addresses" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/nodeip_config.go b/pkg/machinery/resources/k8s/nodeip_config.go index c91f7282ed..2a7c2fc65e 100644 --- a/pkg/machinery/resources/k8s/nodeip_config.go +++ b/pkg/machinery/resources/k8s/nodeip_config.go @@ -17,6 +17,7 @@ const NodeIPConfigType = resource.Type("NodeIPConfigs.kubernetes.talos.dev") type NodeIPConfig = typed.Resource[NodeIPConfigSpec, NodeIPConfigRD] // NodeIPConfigSpec holds the Node IP specification. +// //gotagsrewrite:gen type NodeIPConfigSpec struct { ValidSubnets []string `yaml:"validSubnets,omitempty" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/nodename.go b/pkg/machinery/resources/k8s/nodename.go index 597d1b9651..74afd414b3 100644 --- a/pkg/machinery/resources/k8s/nodename.go +++ b/pkg/machinery/resources/k8s/nodename.go @@ -20,6 +20,7 @@ const NodenameID = resource.ID("nodename") type Nodename = typed.Resource[NodenameSpec, NodenameRD] // NodenameSpec describes Kubernetes nodename. +// //gotagsrewrite:gen type NodenameSpec struct { Nodename string `yaml:"nodename" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/scheduler_config.go b/pkg/machinery/resources/k8s/scheduler_config.go index 43c36923b2..0e01dc0189 100644 --- a/pkg/machinery/resources/k8s/scheduler_config.go +++ b/pkg/machinery/resources/k8s/scheduler_config.go @@ -23,6 +23,7 @@ const SchedulerConfigID = resource.ID(SchedulerID) type SchedulerConfig = typed.Resource[SchedulerConfigSpec, SchedulerConfigRD] // SchedulerConfigSpec is configuration for kube-scheduler. +// //gotagsrewrite:gen type SchedulerConfigSpec struct { Enabled bool `yaml:"enabled" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/secrets_status.go b/pkg/machinery/resources/k8s/secrets_status.go index 9a97665d9b..94825a202c 100644 --- a/pkg/machinery/resources/k8s/secrets_status.go +++ b/pkg/machinery/resources/k8s/secrets_status.go @@ -23,6 +23,7 @@ const StaticPodSecretsStaticPodID = resource.ID("static-pods") type SecretsStatus = typed.Resource[SecretsStatusSpec, SecretsStatusRD] // SecretsStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type SecretsStatusSpec struct { Ready bool `yaml:"ready" protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/static_pod.go b/pkg/machinery/resources/k8s/static_pod.go index bbc9ef9b77..fcea24712a 100644 --- a/pkg/machinery/resources/k8s/static_pod.go +++ b/pkg/machinery/resources/k8s/static_pod.go @@ -17,6 +17,7 @@ const StaticPodType = resource.Type("StaticPods.kubernetes.talos.dev") type StaticPod = typed.Resource[StaticPodSpec, StaticPodRD] // StaticPodSpec describes static pod spec, it contains marshaled *v1.Pod spec. +// //gotagsrewrite:gen type StaticPodSpec struct { Pod map[string]interface{} `protobuf:"1"` diff --git a/pkg/machinery/resources/k8s/static_pod_status.go b/pkg/machinery/resources/k8s/static_pod_status.go index e00d8e587c..605de45745 100644 --- a/pkg/machinery/resources/k8s/static_pod_status.go +++ b/pkg/machinery/resources/k8s/static_pod_status.go @@ -17,6 +17,7 @@ const StaticPodStatusType = resource.Type("StaticPodStatuses.kubernetes.talos.de type StaticPodStatus = typed.Resource[StaticPodStatusSpec, StaticPodStatusRD] // StaticPodStatusSpec describes kubelet static pod status. +// //gotagsrewrite:gen type StaticPodStatusSpec struct { PodStatus map[string]interface{} `protobuf:"1"` diff --git a/pkg/machinery/resources/kubeaccess/config.go b/pkg/machinery/resources/kubeaccess/config.go index 3c63fde2ca..54b9e34bdc 100644 --- a/pkg/machinery/resources/kubeaccess/config.go +++ b/pkg/machinery/resources/kubeaccess/config.go @@ -22,6 +22,7 @@ const ConfigID = resource.ID("config") type Config = typed.Resource[ConfigSpec, ConfigRD] // ConfigSpec describes KubeSpan configuration.. +// //gotagsrewrite:gen type ConfigSpec struct { Enabled bool `yaml:"enabled" protobuf:"1"` diff --git a/pkg/machinery/resources/kubespan/config.go b/pkg/machinery/resources/kubespan/config.go index 1c768110ad..f618bd549c 100644 --- a/pkg/machinery/resources/kubespan/config.go +++ b/pkg/machinery/resources/kubespan/config.go @@ -25,6 +25,7 @@ const ConfigID = resource.ID("kubespan") type Config = typed.Resource[ConfigSpec, ConfigRD] // ConfigSpec describes KubeSpan configuration.. +// //gotagsrewrite:gen type ConfigSpec struct { Enabled bool `yaml:"enabled" protobuf:"1"` diff --git a/pkg/machinery/resources/kubespan/endpoint.go b/pkg/machinery/resources/kubespan/endpoint.go index 979332bb00..88d9f0142d 100644 --- a/pkg/machinery/resources/kubespan/endpoint.go +++ b/pkg/machinery/resources/kubespan/endpoint.go @@ -20,6 +20,7 @@ const EndpointType = resource.Type("KubeSpanEndpoints.kubespan.talos.dev") type Endpoint = typed.Resource[EndpointSpec, EndpointRD] // EndpointSpec describes Endpoint state. +// //gotagsrewrite:gen type EndpointSpec struct { AffiliateID string `yaml:"affiliateID" protobuf:"1"` diff --git a/pkg/machinery/resources/kubespan/identity.go b/pkg/machinery/resources/kubespan/identity.go index 34f315051a..b063b99ec9 100644 --- a/pkg/machinery/resources/kubespan/identity.go +++ b/pkg/machinery/resources/kubespan/identity.go @@ -24,6 +24,7 @@ type Identity = typed.Resource[IdentitySpec, IdentityRD] // // Note: IdentitySpec is persisted on disk in the STATE partition, // so YAML serialization should be kept backwards compatible. +// //gotagsrewrite:gen type IdentitySpec struct { // Address of the node on the Wireguard network. diff --git a/pkg/machinery/resources/kubespan/peer_spec.go b/pkg/machinery/resources/kubespan/peer_spec.go index 7cab139c95..541214f033 100644 --- a/pkg/machinery/resources/kubespan/peer_spec.go +++ b/pkg/machinery/resources/kubespan/peer_spec.go @@ -20,6 +20,7 @@ const PeerSpecType = resource.Type("KubeSpanPeerSpecs.kubespan.talos.dev") type PeerSpec = typed.Resource[PeerSpecSpec, PeerSpecRD] // PeerSpecSpec describes PeerSpec state. +// //gotagsrewrite:gen type PeerSpecSpec struct { Address netaddr.IP `yaml:"address" protobuf:"1"` diff --git a/pkg/machinery/resources/kubespan/peer_status.go b/pkg/machinery/resources/kubespan/peer_status.go index fcc170f076..33862ff121 100644 --- a/pkg/machinery/resources/kubespan/peer_status.go +++ b/pkg/machinery/resources/kubespan/peer_status.go @@ -22,6 +22,7 @@ const PeerStatusType = resource.Type("KubeSpanPeerStatuses.kubespan.talos.dev") type PeerStatus = typed.Resource[PeerStatusSpec, PeerStatusRD] // PeerStatusSpec describes PeerStatus state. +// //gotagsrewrite:gen type PeerStatusSpec struct { // Active endpoint as seen by the Wireguard. diff --git a/pkg/machinery/resources/network/address_spec.go b/pkg/machinery/resources/network/address_spec.go index 40036e29ca..2cf535274a 100644 --- a/pkg/machinery/resources/network/address_spec.go +++ b/pkg/machinery/resources/network/address_spec.go @@ -23,6 +23,7 @@ const AddressSpecType = resource.Type("AddressSpecs.net.talos.dev") type AddressSpec = typed.Resource[AddressSpecSpec, AddressSpecRD] // AddressSpecSpec describes status of rendered secrets. +// //gotagsrewrite:gen type AddressSpecSpec struct { Address netaddr.IPPrefix `yaml:"address" protobuf:"1"` diff --git a/pkg/machinery/resources/network/address_status.go b/pkg/machinery/resources/network/address_status.go index 72e0cf579d..e71119dcea 100644 --- a/pkg/machinery/resources/network/address_status.go +++ b/pkg/machinery/resources/network/address_status.go @@ -20,6 +20,7 @@ const AddressStatusType = resource.Type("AddressStatuses.net.talos.dev") type AddressStatus = typed.Resource[AddressStatusSpec, AddressStatusRD] // AddressStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type AddressStatusSpec struct { Address netaddr.IPPrefix `yaml:"address" protobuf:"1"` diff --git a/pkg/machinery/resources/network/configlayer_enumer.go b/pkg/machinery/resources/network/configlayer_enumer.go index 3736cf7674..07a168f66a 100644 --- a/pkg/machinery/resources/network/configlayer_enumer.go +++ b/pkg/machinery/resources/network/configlayer_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=ConfigLayer -linecomment -text"; DO NOT EDIT. -// package network import ( diff --git a/pkg/machinery/resources/network/device_config_spec.go b/pkg/machinery/resources/network/device_config_spec.go index 8b4bfe2a80..f8e21da1a5 100644 --- a/pkg/machinery/resources/network/device_config_spec.go +++ b/pkg/machinery/resources/network/device_config_spec.go @@ -20,6 +20,7 @@ const DeviceConfigSpecType = resource.Type("DeviceConfigSpecs.net.talos.dev") type DeviceConfigSpec = typed.Resource[DeviceConfigSpecSpec, DeviceConfigSpecRD] // DeviceConfigSpecSpec contains the spec of a device config. +// //gotagsrewrite:gen type DeviceConfigSpecSpec struct { Device config.Device `protobuf:"1"` diff --git a/pkg/machinery/resources/network/hardrware_addr.go b/pkg/machinery/resources/network/hardrware_addr.go index 179a002bee..d54e95d5d2 100644 --- a/pkg/machinery/resources/network/hardrware_addr.go +++ b/pkg/machinery/resources/network/hardrware_addr.go @@ -22,6 +22,7 @@ const FirstHardwareAddr = resource.ID("first") type HardwareAddr = typed.Resource[HardwareAddrSpec, HardwareAddrRD] // HardwareAddrSpec describes spec for the link. +// //gotagsrewrite:gen type HardwareAddrSpec struct { // Name defines link name diff --git a/pkg/machinery/resources/network/hostname_spec.go b/pkg/machinery/resources/network/hostname_spec.go index 7236664399..b2dd7c2989 100644 --- a/pkg/machinery/resources/network/hostname_spec.go +++ b/pkg/machinery/resources/network/hostname_spec.go @@ -23,6 +23,7 @@ type HostnameSpec = typed.Resource[HostnameSpecSpec, HostnameSpecRD] const HostnameID resource.ID = "hostname" // HostnameSpecSpec describes node nostname. +// //gotagsrewrite:gen type HostnameSpecSpec struct { Hostname string `yaml:"hostname" protobuf:"1"` diff --git a/pkg/machinery/resources/network/hostname_status.go b/pkg/machinery/resources/network/hostname_status.go index cce1dfc7c7..0f7f258500 100644 --- a/pkg/machinery/resources/network/hostname_status.go +++ b/pkg/machinery/resources/network/hostname_status.go @@ -17,6 +17,7 @@ const HostnameStatusType = resource.Type("HostnameStatuses.net.talos.dev") type HostnameStatus = typed.Resource[HostnameStatusSpec, HostnameStatusRD] // HostnameStatusSpec describes node nostname. +// //gotagsrewrite:gen type HostnameStatusSpec struct { Hostname string `yaml:"hostname" protobuf:"1"` diff --git a/pkg/machinery/resources/network/link.go b/pkg/machinery/resources/network/link.go index 02bb2dc5bf..c6c557e330 100644 --- a/pkg/machinery/resources/network/link.go +++ b/pkg/machinery/resources/network/link.go @@ -14,6 +14,7 @@ import ( ) // VLANSpec describes VLAN settings if Kind == "vlan". +// //gotagsrewrite:gen type VLANSpec struct { // VID is the vlan ID. @@ -24,6 +25,7 @@ type VLANSpec struct { } // BondMasterSpec describes bond settings if Kind == "bond". +// //gotagsrewrite:gen type BondMasterSpec struct { Mode nethelpers.BondMode `yaml:"mode" protobuf:"1"` diff --git a/pkg/machinery/resources/network/link_refresh.go b/pkg/machinery/resources/network/link_refresh.go index e5478bed59..0cd5a3ae48 100644 --- a/pkg/machinery/resources/network/link_refresh.go +++ b/pkg/machinery/resources/network/link_refresh.go @@ -23,6 +23,7 @@ const LinkRefreshType = resource.Type("LinkRefreshes.net.talos.dev") type LinkRefresh = typed.Resource[LinkRefreshSpec, LinkRefreshRD] // LinkRefreshSpec describes status of rendered secrets. +// //gotagsrewrite:gen type LinkRefreshSpec struct { Generation int `yaml:"generation" protobuf:"1"` diff --git a/pkg/machinery/resources/network/link_spec.go b/pkg/machinery/resources/network/link_spec.go index e5431463fa..1d6fb170b1 100644 --- a/pkg/machinery/resources/network/link_spec.go +++ b/pkg/machinery/resources/network/link_spec.go @@ -19,6 +19,7 @@ const LinkSpecType = resource.Type("LinkSpecs.net.talos.dev") type LinkSpec = typed.Resource[LinkSpecSpec, LinkSpecRD] // LinkSpecSpec describes spec for the link. +// //gotagsrewrite:gen type LinkSpecSpec struct { // Name defines link name @@ -59,6 +60,7 @@ type LinkSpecSpec struct { } // BondSlave contains a bond's master name and slave index. +// //gotagsrewrite:gen type BondSlave struct { // MasterName indicates master link for enslaved bonded interfaces. @@ -69,6 +71,7 @@ type BondSlave struct { } // BridgeSlave contains a bond's master name and slave index. +// //gotagsrewrite:gen type BridgeSlave struct { // MasterName indicates master link for enslaved bridged interfaces. diff --git a/pkg/machinery/resources/network/link_status.go b/pkg/machinery/resources/network/link_status.go index 0df3ba7685..5428f70b75 100644 --- a/pkg/machinery/resources/network/link_status.go +++ b/pkg/machinery/resources/network/link_status.go @@ -19,6 +19,7 @@ const LinkStatusType = resource.Type("LinkStatuses.net.talos.dev") type LinkStatus = typed.Resource[LinkStatusSpec, LinkStatusRD] // LinkStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type LinkStatusSpec struct { // Fields coming from rtnetlink API. diff --git a/pkg/machinery/resources/network/node_address.go b/pkg/machinery/resources/network/node_address.go index da1a88f519..226f5121f9 100644 --- a/pkg/machinery/resources/network/node_address.go +++ b/pkg/machinery/resources/network/node_address.go @@ -38,6 +38,7 @@ const ( ) // NodeAddressSpec describes a set of node addresses. +// //gotagsrewrite:gen type NodeAddressSpec struct { Addresses []netaddr.IPPrefix `yaml:"addresses" protobuf:"1"` diff --git a/pkg/machinery/resources/network/node_address_filter.go b/pkg/machinery/resources/network/node_address_filter.go index ca93d4b817..1ad7fcf22a 100644 --- a/pkg/machinery/resources/network/node_address_filter.go +++ b/pkg/machinery/resources/network/node_address_filter.go @@ -18,6 +18,7 @@ const NodeAddressFilterType = resource.Type("NodeAddressFilters.net.talos.dev") type NodeAddressFilter = typed.Resource[NodeAddressFilterSpec, NodeAddressFilterRD] // NodeAddressFilterSpec describes a filter for NodeAddresses. +// //gotagsrewrite:gen type NodeAddressFilterSpec struct { // Address is skipped if it doesn't match any of the includeSubnets (if includeSubnets is not empty). diff --git a/pkg/machinery/resources/network/operator_enumer.go b/pkg/machinery/resources/network/operator_enumer.go index f814750470..513f94c2ce 100644 --- a/pkg/machinery/resources/network/operator_enumer.go +++ b/pkg/machinery/resources/network/operator_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=Operator -linecomment -text"; DO NOT EDIT. -// package network import ( diff --git a/pkg/machinery/resources/network/operator_spec.go b/pkg/machinery/resources/network/operator_spec.go index ee0f56a213..7930391e40 100644 --- a/pkg/machinery/resources/network/operator_spec.go +++ b/pkg/machinery/resources/network/operator_spec.go @@ -18,6 +18,7 @@ const OperatorSpecType = resource.Type("OperatorSpecs.net.talos.dev") type OperatorSpec = typed.Resource[OperatorSpecSpec, OperatorSpecRD] // OperatorSpecSpec describes DNS resolvers. +// //gotagsrewrite:gen type OperatorSpecSpec struct { Operator Operator `yaml:"operator" protobuf:"1"` @@ -32,12 +33,14 @@ type OperatorSpecSpec struct { } // DHCP4OperatorSpec describes DHCP4 operator options. +// //gotagsrewrite:gen type DHCP4OperatorSpec struct { RouteMetric uint32 `yaml:"routeMetric" protobuf:"1"` } // DHCP6OperatorSpec describes DHCP6 operator options. +// //gotagsrewrite:gen type DHCP6OperatorSpec struct { DUID string `yaml:"DUID,omitempty" protobuf:"1"` @@ -45,6 +48,7 @@ type DHCP6OperatorSpec struct { } // VIPOperatorSpec describes virtual IP operator options. +// //gotagsrewrite:gen type VIPOperatorSpec struct { IP netaddr.IP `yaml:"ip" protobuf:"1"` @@ -55,6 +59,7 @@ type VIPOperatorSpec struct { } // VIPEquinixMetalSpec describes virtual (elastic) IP settings for Equinix Metal. +// //gotagsrewrite:gen type VIPEquinixMetalSpec struct { ProjectID string `yaml:"projectID" protobuf:"1"` @@ -63,6 +68,7 @@ type VIPEquinixMetalSpec struct { } // VIPHCloudSpec describes virtual (elastic) IP settings for Hetzner Cloud. +// //gotagsrewrite:gen type VIPHCloudSpec struct { DeviceID int `yaml:"deviceID" protobuf:"1"` diff --git a/pkg/machinery/resources/network/resolver_spec.go b/pkg/machinery/resources/network/resolver_spec.go index a635f85ad2..e5f55ba458 100644 --- a/pkg/machinery/resources/network/resolver_spec.go +++ b/pkg/machinery/resources/network/resolver_spec.go @@ -21,6 +21,7 @@ type ResolverSpec = typed.Resource[ResolverSpecSpec, ResolverSpecRD] const ResolverID resource.ID = "resolvers" // ResolverSpecSpec describes DNS resolvers. +// //gotagsrewrite:gen type ResolverSpecSpec struct { DNSServers []netaddr.IP `yaml:"dnsServers" protobuf:"1"` diff --git a/pkg/machinery/resources/network/resolver_status.go b/pkg/machinery/resources/network/resolver_status.go index 4d77f87d1d..c0f236a14a 100644 --- a/pkg/machinery/resources/network/resolver_status.go +++ b/pkg/machinery/resources/network/resolver_status.go @@ -18,6 +18,7 @@ const ResolverStatusType = resource.Type("ResolverStatuses.net.talos.dev") type ResolverStatus = typed.Resource[ResolverStatusSpec, ResolverStatusRD] // ResolverStatusSpec describes DNS resolvers. +// //gotagsrewrite:gen type ResolverStatusSpec struct { DNSServers []netaddr.IP `yaml:"dnsServers" protobuf:"1"` diff --git a/pkg/machinery/resources/network/route_spec.go b/pkg/machinery/resources/network/route_spec.go index d44de81855..64dd4c8da3 100644 --- a/pkg/machinery/resources/network/route_spec.go +++ b/pkg/machinery/resources/network/route_spec.go @@ -20,6 +20,7 @@ const RouteSpecType = resource.Type("RouteSpecs.net.talos.dev") type RouteSpec = typed.Resource[RouteSpecSpec, RouteSpecRD] // RouteSpecSpec describes the route. +// //gotagsrewrite:gen type RouteSpecSpec struct { Family nethelpers.Family `yaml:"family" protobuf:"1"` diff --git a/pkg/machinery/resources/network/route_status.go b/pkg/machinery/resources/network/route_status.go index 8724470b4d..0a498294db 100644 --- a/pkg/machinery/resources/network/route_status.go +++ b/pkg/machinery/resources/network/route_status.go @@ -20,6 +20,7 @@ const RouteStatusType = resource.Type("RouteStatuses.net.talos.dev") type RouteStatus = typed.Resource[RouteStatusSpec, RouteStatusRD] // RouteStatusSpec describes status of rendered secrets. +// //gotagsrewrite:gen type RouteStatusSpec struct { Family nethelpers.Family `yaml:"family" protobuf:"1"` diff --git a/pkg/machinery/resources/network/status.go b/pkg/machinery/resources/network/status.go index 21d4422047..4f4e282918 100644 --- a/pkg/machinery/resources/network/status.go +++ b/pkg/machinery/resources/network/status.go @@ -17,6 +17,7 @@ const StatusType = resource.Type("NetworkStatuses.net.talos.dev") type Status = typed.Resource[StatusSpec, StatusRD] // StatusSpec describes network state. +// //gotagsrewrite:gen type StatusSpec struct { AddressReady bool `yaml:"addressReady" protobuf:"1"` diff --git a/pkg/machinery/resources/network/timeserver_spec.go b/pkg/machinery/resources/network/timeserver_spec.go index ecbccdfddc..2d6548f326 100644 --- a/pkg/machinery/resources/network/timeserver_spec.go +++ b/pkg/machinery/resources/network/timeserver_spec.go @@ -20,6 +20,7 @@ type TimeServerSpec = typed.Resource[TimeServerSpecSpec, TimeServerSpecRD] const TimeServerID resource.ID = "timeservers" // TimeServerSpecSpec describes NTP servers. +// //gotagsrewrite:gen type TimeServerSpecSpec struct { NTPServers []string `yaml:"timeServers" protobuf:"1"` diff --git a/pkg/machinery/resources/network/timeserver_status.go b/pkg/machinery/resources/network/timeserver_status.go index 98033346f8..4d62888c40 100644 --- a/pkg/machinery/resources/network/timeserver_status.go +++ b/pkg/machinery/resources/network/timeserver_status.go @@ -17,6 +17,7 @@ const TimeServerStatusType = resource.Type("TimeServerStatuses.net.talos.dev") type TimeServerStatus = typed.Resource[TimeServerStatusSpec, TimeServerStatusRD] // TimeServerStatusSpec describes NTP servers. +// //gotagsrewrite:gen type TimeServerStatusSpec struct { NTPServers []string `yaml:"timeServers" protobuf:"1"` diff --git a/pkg/machinery/resources/perf/cpu.go b/pkg/machinery/resources/perf/cpu.go index 2ed396fcf7..a8115261e1 100644 --- a/pkg/machinery/resources/perf/cpu.go +++ b/pkg/machinery/resources/perf/cpu.go @@ -23,6 +23,7 @@ const CPUID = resource.ID("latest") type CPU = typed.Resource[CPUSpec, CPURD] // CPUSpec represents the last CPU stats snapshot. +// //gotagsrewrite:gen type CPUSpec struct { CPU []CPUStat `yaml:"cpu" protobuf:"1"` @@ -36,6 +37,7 @@ type CPUSpec struct { } // CPUStat represents a single cpu stat. +// //gotagsrewrite:gen type CPUStat struct { User float64 `yaml:"user" protobuf:"1"` diff --git a/pkg/machinery/resources/perf/mem.go b/pkg/machinery/resources/perf/mem.go index 6b1e6f06b6..2a6a15bad9 100644 --- a/pkg/machinery/resources/perf/mem.go +++ b/pkg/machinery/resources/perf/mem.go @@ -20,6 +20,7 @@ const MemoryID = resource.ID("latest") type Memory = typed.Resource[MemorySpec, MemoryRD] // MemorySpec represents the last Memory stats snapshot. +// //gotagsrewrite:gen type MemorySpec struct { MemTotal uint64 `yaml:"total" protobuf:"1"` diff --git a/pkg/machinery/resources/runtime/kernel_module_spec.go b/pkg/machinery/resources/runtime/kernel_module_spec.go index 89b64c3921..5def31c293 100644 --- a/pkg/machinery/resources/runtime/kernel_module_spec.go +++ b/pkg/machinery/resources/runtime/kernel_module_spec.go @@ -17,6 +17,7 @@ const KernelModuleSpecType = resource.Type("KernelModuleSpecs.runtime.talos.dev" type KernelModuleSpec = typed.Resource[KernelModuleSpecSpec, KernelModuleSpecRD] // KernelModuleSpecSpec describes Linux kernel module to load. +// //gotagsrewrite:gen type KernelModuleSpecSpec struct { Name string `yaml:"string" protobuf:"1"` diff --git a/pkg/machinery/resources/runtime/kernel_params_spec.go b/pkg/machinery/resources/runtime/kernel_params_spec.go index 89b648a1bb..dd24ad1565 100644 --- a/pkg/machinery/resources/runtime/kernel_params_spec.go +++ b/pkg/machinery/resources/runtime/kernel_params_spec.go @@ -30,6 +30,7 @@ type KernelParam interface { type KernelParamSpec = typed.Resource[KernelParamSpecSpec, KernelParamSpecRD] // KernelParamSpecSpec describes status of the defined sysctls. +// //gotagsrewrite:gen type KernelParamSpecSpec struct { Value string `yaml:"value" protobuf:"1"` diff --git a/pkg/machinery/resources/runtime/kernel_params_status.go b/pkg/machinery/resources/runtime/kernel_params_status.go index 1b44f2e4fd..24024efb8a 100644 --- a/pkg/machinery/resources/runtime/kernel_params_status.go +++ b/pkg/machinery/resources/runtime/kernel_params_status.go @@ -17,6 +17,7 @@ const KernelParamStatusType = resource.Type("KernelParamStatuses.runtime.talos.d type KernelParamStatus = typed.Resource[KernelParamStatusSpec, KernelParamStatusRD] // KernelParamStatusSpec describes status of the defined sysctls. +// //gotagsrewrite:gen type KernelParamStatusSpec struct { Current string `yaml:"current" protobuf:"1"` diff --git a/pkg/machinery/resources/runtime/machine_status.go b/pkg/machinery/resources/runtime/machine_status.go index 4e403a06d9..38a22712ea 100644 --- a/pkg/machinery/resources/runtime/machine_status.go +++ b/pkg/machinery/resources/runtime/machine_status.go @@ -20,6 +20,7 @@ const MachineStatusID = resource.ID("machine") type MachineStatus = typed.Resource[MachineStatusSpec, MachineStatusRD] // MachineStatusSpec describes status of the defined sysctls. +// //gotagsrewrite:gen type MachineStatusSpec struct { Stage MachineStage `yaml:"stage" protobuf:"1"` @@ -27,6 +28,7 @@ type MachineStatusSpec struct { } // MachineStatusStatus describes machine current status at the stage. +// //gotagsrewrite:gen type MachineStatusStatus struct { Ready bool `yaml:"ready" protobuf:"1"` @@ -34,6 +36,7 @@ type MachineStatusStatus struct { } // UnmetCondition is a failure which prevents machine from being ready at the stage. +// //gotagsrewrite:gen type UnmetCondition struct { Name string `yaml:"name" protobuf:"1"` diff --git a/pkg/machinery/resources/runtime/machinestage_enumer.go b/pkg/machinery/resources/runtime/machinestage_enumer.go index 096def180a..27641b9aac 100644 --- a/pkg/machinery/resources/runtime/machinestage_enumer.go +++ b/pkg/machinery/resources/runtime/machinestage_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type=MachineStage -linecomment -text"; DO NOT EDIT. -// package runtime import ( diff --git a/pkg/machinery/resources/runtime/mount_status.go b/pkg/machinery/resources/runtime/mount_status.go index a96f681129..f0302f6172 100644 --- a/pkg/machinery/resources/runtime/mount_status.go +++ b/pkg/machinery/resources/runtime/mount_status.go @@ -17,6 +17,7 @@ const MountStatusType = resource.Type("MountStatuses.runtime.talos.dev") type MountStatus = typed.Resource[MountStatusSpec, MountStatusRD] // MountStatusSpec describes status of the defined sysctls. +// //gotagsrewrite:gen type MountStatusSpec struct { Source string `yaml:"source" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/api.go b/pkg/machinery/resources/secrets/api.go index 4b4789cf61..4f8478c99f 100644 --- a/pkg/machinery/resources/secrets/api.go +++ b/pkg/machinery/resources/secrets/api.go @@ -28,6 +28,7 @@ const APIID = resource.ID("api") type API = typed.Resource[APICertsSpec, APIRD] // APICertsSpec describes etcd certs secrets. +// //gotagsrewrite:gen type APICertsSpec struct { CA *x509.PEMEncodedCertificateAndKey `yaml:"ca" protobuf:"1"` // only cert is passed, without key diff --git a/pkg/machinery/resources/secrets/cert_sans.go b/pkg/machinery/resources/secrets/cert_sans.go index 10253c85a4..cbb4f9f280 100644 --- a/pkg/machinery/resources/secrets/cert_sans.go +++ b/pkg/machinery/resources/secrets/cert_sans.go @@ -29,6 +29,7 @@ const CertSANKubernetesID = resource.ID("k8s") type CertSAN = typed.Resource[CertSANSpec, CertSANRD] // CertSANSpec describes fields of the cert SANs. +// //gotagsrewrite:gen type CertSANSpec struct { IPs []netaddr.IP `yaml:"ips" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/etcd.go b/pkg/machinery/resources/secrets/etcd.go index 7d3a9e7037..7b4cddeaa5 100644 --- a/pkg/machinery/resources/secrets/etcd.go +++ b/pkg/machinery/resources/secrets/etcd.go @@ -21,6 +21,7 @@ const EtcdID = resource.ID("etcd") type Etcd = typed.Resource[EtcdCertsSpec, EtcdRD] // EtcdCertsSpec describes etcd certs secrets. +// //gotagsrewrite:gen type EtcdCertsSpec struct { Etcd *x509.PEMEncodedCertificateAndKey `yaml:"etcd" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/etcd_root.go b/pkg/machinery/resources/secrets/etcd_root.go index 61fe5fa2a6..28c3ab27bb 100644 --- a/pkg/machinery/resources/secrets/etcd_root.go +++ b/pkg/machinery/resources/secrets/etcd_root.go @@ -21,6 +21,7 @@ const EtcdRootID = resource.ID("etcd") type EtcdRoot = typed.Resource[EtcdRootSpec, EtcdRootRD] // EtcdRootSpec describes etcd CA secrets. +// //gotagsrewrite:gen type EtcdRootSpec struct { EtcdCA *x509.PEMEncodedCertificateAndKey `yaml:"etcdCA" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/kubelet.go b/pkg/machinery/resources/secrets/kubelet.go index 02bf286a9e..4d477d548f 100644 --- a/pkg/machinery/resources/secrets/kubelet.go +++ b/pkg/machinery/resources/secrets/kubelet.go @@ -23,6 +23,7 @@ const KubeletID = resource.ID("kubelet") type Kubelet = typed.Resource[KubeletSpec, KubeletRD] // KubeletSpec describes root Kubernetes secrets. +// //gotagsrewrite:gen type KubeletSpec struct { Endpoint *url.URL `yaml:"endpoint" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/kubernetes.go b/pkg/machinery/resources/secrets/kubernetes.go index d6e5780b1b..6c53f69a05 100644 --- a/pkg/machinery/resources/secrets/kubernetes.go +++ b/pkg/machinery/resources/secrets/kubernetes.go @@ -21,6 +21,7 @@ const KubernetesID = resource.ID("k8s-certs") type Kubernetes = typed.Resource[KubernetesCertsSpec, KubernetesRD] // KubernetesCertsSpec describes generated Kubernetes certificates. +// //gotagsrewrite:gen type KubernetesCertsSpec struct { APIServer *x509.PEMEncodedCertificateAndKey `yaml:"apiServer" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/kubernetes_root.go b/pkg/machinery/resources/secrets/kubernetes_root.go index d1b0e687bb..8244a9cf73 100644 --- a/pkg/machinery/resources/secrets/kubernetes_root.go +++ b/pkg/machinery/resources/secrets/kubernetes_root.go @@ -24,6 +24,7 @@ const KubernetesRootID = resource.ID("k8s") type KubernetesRoot = typed.Resource[KubernetesRootSpec, KubernetesRootRD] // KubernetesRootSpec describes root Kubernetes secrets. +// //gotagsrewrite:gen type KubernetesRootSpec struct { Name string `yaml:"name" protobuf:"1"` diff --git a/pkg/machinery/resources/secrets/os_root.go b/pkg/machinery/resources/secrets/os_root.go index 55822665b7..83174d327d 100644 --- a/pkg/machinery/resources/secrets/os_root.go +++ b/pkg/machinery/resources/secrets/os_root.go @@ -22,6 +22,7 @@ const OSRootID = resource.ID("os") type OSRoot = typed.Resource[OSRootSpec, OSRootRD] // OSRootSpec describes operating system CA. +// //gotagsrewrite:gen type OSRootSpec struct { CA *x509.PEMEncodedCertificateAndKey `yaml:"ca" protobuf:"1"` diff --git a/pkg/machinery/resources/time/status.go b/pkg/machinery/resources/time/status.go index e6064a229f..e77c319d08 100644 --- a/pkg/machinery/resources/time/status.go +++ b/pkg/machinery/resources/time/status.go @@ -25,6 +25,7 @@ const StatusID = resource.ID("node") type Status = typed.Resource[StatusSpec, StatusRD] // StatusSpec describes time sync state. +// //gotagsrewrite:gen type StatusSpec struct { // Synced indicates whether time is in sync. diff --git a/pkg/machinery/resources/v1alpha1/service.go b/pkg/machinery/resources/v1alpha1/service.go index ca51b7b31b..fa5b2ade1f 100644 --- a/pkg/machinery/resources/v1alpha1/service.go +++ b/pkg/machinery/resources/v1alpha1/service.go @@ -20,6 +20,7 @@ const ServiceType = resource.Type("Services.v1alpha1.talos.dev") type Service = typed.Resource[ServiceSpec, ServiceRD] // ServiceSpec describe service state. +// //gotagsrewrite:gen type ServiceSpec struct { Running bool `yaml:"running" protobuf:"1"` diff --git a/pkg/provision/internal/inmemhttp/inmemhttp_test.go b/pkg/provision/internal/inmemhttp/inmemhttp_test.go index 405b21c300..52ce610779 100644 --- a/pkg/provision/internal/inmemhttp/inmemhttp_test.go +++ b/pkg/provision/internal/inmemhttp/inmemhttp_test.go @@ -7,7 +7,7 @@ package inmemhttp_test import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "testing" @@ -34,7 +34,7 @@ func TestServer(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) - got, err := ioutil.ReadAll(resp.Body) + got, err := io.ReadAll(resp.Body) assert.NoError(t, err) assert.Equal(t, contents, got) diff --git a/pkg/provision/providers/docker/image.go b/pkg/provision/providers/docker/image.go index fdb087466f..90bc303351 100644 --- a/pkg/provision/providers/docker/image.go +++ b/pkg/provision/providers/docker/image.go @@ -8,7 +8,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" @@ -56,7 +55,7 @@ func (p *provisioner) ensureImageExists(ctx context.Context, image string, optio //nolint:errcheck defer reader.Close() - if _, err = io.Copy(ioutil.Discard, reader); err != nil { + if _, err = io.Copy(io.Discard, reader); err != nil { return err } } diff --git a/pkg/provision/providers/qemu/node.go b/pkg/provision/providers/qemu/node.go index daf76310aa..fe1bc78878 100644 --- a/pkg/provision/providers/qemu/node.go +++ b/pkg/provision/providers/qemu/node.go @@ -8,7 +8,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math" "net" "os" @@ -179,7 +178,7 @@ func (p *provisioner) createNode(state *vm.State, clusterReq provision.ClusterRe return provision.NodeInfo{}, err } - if err = ioutil.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { + if err = os.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { return provision.NodeInfo{}, fmt.Errorf("error writing PID file: %w", err) } diff --git a/pkg/provision/providers/vm/dhcpd.go b/pkg/provision/providers/vm/dhcpd.go index fae68661b9..3fc791c5da 100644 --- a/pkg/provision/providers/vm/dhcpd.go +++ b/pkg/provision/providers/vm/dhcpd.go @@ -6,7 +6,6 @@ package vm import ( "fmt" - "io/ioutil" "log" "net" "os" @@ -281,7 +280,7 @@ func (p *Provisioner) CreateDHCPd(state *State, clusterReq provision.ClusterRequ return err } - if err = ioutil.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { + if err = os.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { return fmt.Errorf("error writing dhcp PID file: %w", err) } diff --git a/pkg/provision/providers/vm/launch.go b/pkg/provision/providers/vm/launch.go index e661fdd6df..51b0fffbb6 100644 --- a/pkg/provision/providers/vm/launch.go +++ b/pkg/provision/providers/vm/launch.go @@ -8,7 +8,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net" "net/http" "os" @@ -46,8 +45,8 @@ func httpPostWrapper(f func() error) http.Handler { return http.HandlerFunc( func(w http.ResponseWriter, req *http.Request) { if req.Body != nil { - _, _ = io.Copy(ioutil.Discard, req.Body) //nolint:errcheck - req.Body.Close() //nolint:errcheck + _, _ = io.Copy(io.Discard, req.Body) //nolint:errcheck + req.Body.Close() //nolint:errcheck } if req.Method != http.MethodPost { @@ -74,8 +73,8 @@ func httpGetWrapper(f func(w io.Writer)) http.Handler { return http.HandlerFunc( func(w http.ResponseWriter, req *http.Request) { if req.Body != nil { - _, _ = io.Copy(ioutil.Discard, req.Body) //nolint:errcheck - req.Body.Close() //nolint:errcheck + _, _ = io.Copy(io.Discard, req.Body) //nolint:errcheck + req.Body.Close() //nolint:errcheck } switch req.Method { diff --git a/pkg/provision/providers/vm/loadbalancer.go b/pkg/provision/providers/vm/loadbalancer.go index 2c3a382967..5950690762 100644 --- a/pkg/provision/providers/vm/loadbalancer.go +++ b/pkg/provision/providers/vm/loadbalancer.go @@ -6,7 +6,6 @@ package vm import ( "fmt" - "io/ioutil" "os" "os/exec" "strconv" @@ -57,7 +56,7 @@ func (p *Provisioner) CreateLoadBalancer(state *State, clusterReq provision.Clus return err } - if err = ioutil.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { + if err = os.WriteFile(pidPath, []byte(strconv.Itoa(cmd.Process.Pid)), os.ModePerm); err != nil { return fmt.Errorf("error writing LB PID file: %w", err) }