Skip to content

Commit 3c9f7a7

Browse files
committed
chore: re-enable nolintlint and typecheck linters
Drop startup/rand.go, as since Go 1.20 `rand.Seed` is done automatically. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent c51e2c9 commit 3c9f7a7

File tree

135 files changed

+72
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+72
-265
lines changed

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,11 @@ linters:
156156
- nestif
157157
- nilnil # we return "nil, nil"
158158
- nonamedreturns
159-
- nolintlint
160159
- nosnakecase
161160
- paralleltest
162161
- promlinter # https://github.com/golangci/golangci-lint/issues/2222
163162
- tagliatelle # we have many different conventions
164163
- thelper
165-
- typecheck
166164
- varnamelen # too annoying
167165
- wrapcheck
168166
- contextcheck # enable once golangci-lint 1.50.1 or 1.51 lands

cmd/installer/pkg/install/extensions.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/siderolabs/talos/pkg/machinery/constants"
1414
)
1515

16-
// nolint:gocyclo
1716
func (i *Installer) installExtensions() error {
1817
builder := extensions.Builder{
1918
InitramfsPath: fmt.Sprintf(constants.InitramfsAssetPath, i.options.Arch),

cmd/talosctl/cmd/mgmt/gen/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ func validateFlags() error {
287287
return err
288288
}
289289

290-
// nolint:gocyclo
291290
func writeConfigBundle(configBundle *bundle.Bundle, outputPaths configOutputPaths, commentsFlags encoder.CommentsFlags) error {
292291
outputTypesSet := slices.ToSet(genConfigCmdFlags.outputTypes)
293292

cmd/talosctl/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ import (
99
"os"
1010

1111
"github.com/siderolabs/talos/cmd/talosctl/cmd"
12-
"github.com/siderolabs/talos/pkg/cli"
13-
"github.com/siderolabs/talos/pkg/startup"
1412
)
1513

1614
func main() {
17-
cli.Should(startup.RandSeed())
18-
1915
if err := cmd.Execute(); err != nil {
2016
os.Exit(1)
2117
}

hack/cloud-image-uploader/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ package main
88
import (
99
"context"
1010
cryptorand "crypto/rand"
11-
"encoding/binary"
1211
"encoding/json"
1312
"fmt"
1413
"io"
1514
"log"
16-
"math/rand"
1715
"os"
1816
"path/filepath"
1917
"sync"
@@ -77,8 +75,6 @@ func run() error {
7775
log.Fatalf("error seeding rand: %s", err)
7876
}
7977

80-
rand.Seed(int64(binary.LittleEndian.Uint64(seed))) //nolint:staticcheck
81-
8278
ctx, cancel := context.WithCancel(context.Background())
8379
defer cancel()
8480

internal/app/apid/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ func apidMain() error {
7272

7373
startup.LimitMaxProcs(constants.ApidMaxProcs)
7474

75-
if err := startup.RandSeed(); err != nil {
76-
return fmt.Errorf("failed to seed RNG: %w", err)
77-
}
78-
7975
runtimeConn, err := grpc.Dial("unix://"+constants.APIRuntimeSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials()))
8076
if err != nil {
8177
return fmt.Errorf("failed to dial runtime connection: %w", err)

internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (cl *clusterState) String() string {
117117
}))
118118
}
119119

120-
//nolint:gocyclo,cyclop
120+
//nolint:gocyclo
121121
func buildClusterInfo(ctx context.Context,
122122
req *clusterapi.HealthCheckRequest,
123123
r runtime.Runtime,

internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,6 @@ func (s *Server) GenerateConfiguration(ctx context.Context, in *machine.Generate
297297
}
298298

299299
// Reboot implements the machine.MachineServer interface.
300-
//
301-
//nolint:dupl
302300
func (s *Server) Reboot(ctx context.Context, in *machine.RebootRequest) (reply *machine.RebootResponse, err error) {
303301
actorID := uuid.New().String()
304302

@@ -330,8 +328,6 @@ func (s *Server) Reboot(ctx context.Context, in *machine.RebootRequest) (reply *
330328
}
331329

332330
// Rollback implements the machine.MachineServer interface.
333-
//
334-
//nolint:gocyclo
335331
func (s *Server) Rollback(ctx context.Context, in *machine.RollbackRequest) (*machine.RollbackResponse, error) {
336332
log.Printf("rollback via API received")
337333

@@ -407,8 +403,6 @@ func (s *Server) Bootstrap(ctx context.Context, in *machine.BootstrapRequest) (r
407403
}
408404

409405
// Shutdown implements the machine.MachineServer interface.
410-
//
411-
//nolint:dupl
412406
func (s *Server) Shutdown(ctx context.Context, in *machine.ShutdownRequest) (reply *machine.ShutdownResponse, err error) {
413407
actorID := uuid.New().String()
414408

@@ -563,7 +557,7 @@ func (opt *ResetOptions) GetSystemDiskTargets() []runtime.PartitionTarget {
563557

564558
// Reset resets the node.
565559
//
566-
//nolint:gocyclo,cyclop
560+
//nolint:gocyclo
567561
func (s *Server) Reset(ctx context.Context, in *machine.ResetRequest) (reply *machine.ResetResponse, err error) {
568562
actorID := uuid.New().String()
569563

@@ -2229,7 +2223,7 @@ func (s *Server) PacketCapture(in *machine.PacketCaptureRequest, srv machine.Mac
22292223
if err = srv.SendMsg(&common.Data{Bytes: data}); err != nil {
22302224
cancel()
22312225

2232-
pr.CloseWithError(err) //nolint:errcheck
2226+
pr.CloseWithError(err)
22332227
}
22342228
}
22352229

@@ -2244,7 +2238,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui
22442238
pcapw := pcapgo.NewWriterNanos(pw)
22452239

22462240
if err := pcapw.WriteFileHeader(snapLen, linkType); err != nil {
2247-
pw.CloseWithError(err) //nolint:errcheck
2241+
pw.CloseWithError(err)
22482242

22492243
return
22502244
}
@@ -2263,7 +2257,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui
22632257
packet, err := pkgsrc.NextPacket()
22642258
if err == nil {
22652259
if err = pcapw.WritePacket(packet.Metadata().CaptureInfo, packet.Data()); err != nil {
2266-
pw.CloseWithError(err) //nolint:errcheck
2260+
pw.CloseWithError(err)
22672261

22682262
return
22692263
}
@@ -2286,7 +2280,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui
22862280
errors.Is(err, io.ErrNoProgress) || errors.Is(err, io.ErrClosedPipe) || errors.Is(err, io.ErrShortBuffer) ||
22872281
errors.Is(err, syscall.EBADF) ||
22882282
strings.Contains(err.Error(), "use of closed file") {
2289-
pw.CloseWithError(err) //nolint:errcheck
2283+
pw.CloseWithError(err)
22902284

22912285
return
22922286
}

internal/app/machined/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@ func run() error {
167167
// Limit GOMAXPROCS.
168168
startup.LimitMaxProcs(constants.MachinedMaxProcs)
169169

170-
// Ensure RNG is seeded.
171-
if err := startup.RandSeed(); err != nil {
172-
return err
173-
}
174-
175170
// Set the PATH env var.
176171
if err := os.Setenv("PATH", constants.PATH); err != nil {
177172
return errors.New("error setting PATH")

internal/app/machined/pkg/controllers/cluster/discovery_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func (ctrl *DiscoveryServiceController) Run(ctx context.Context, r controller.Ru
273273
Affiliate: localData,
274274
Endpoints: localEndpoints,
275275
}, otherEndpoints); err != nil {
276-
return fmt.Errorf("error setting local affiliate data: %w", err) //nolint:govet
276+
return fmt.Errorf("error setting local affiliate data: %w", err)
277277
}
278278

279279
prevLocalData = localData
@@ -312,7 +312,7 @@ func (ctrl *DiscoveryServiceController) Run(ctx context.Context, r controller.Ru
312312

313313
return nil
314314
}); err != nil {
315-
return err //nolint:govet
315+
return err
316316
}
317317

318318
touchedIDs[id] = struct{}{}

0 commit comments

Comments
 (0)