Skip to content

Fix GO_MODULES linter CI action #200

Description

@bstoll

We used to use super-linter v5 with go checks disabled (example). When updating to v8 this was reintroduced because of a new GO_MODULES check (example). We should look into these and see if we can get this check enabled again.

GO_MODULES
  2025-08-27 06:09:46 [INFO]   Linting GO_MODULES items...
  Error: -27 06:10:44 [ERROR]   Found errors when linting GO_MODULES. Exit code: 1.
  2025-08-27 06:10:44 [INFO]   Command output for GO_MODULES:
  ------
  ../../../github/workspace/dhcp/dhcp.go:143:23: Error return value of `instance.server.Wait` is not checked (errcheck)
  		instance.server.Wait()
  		                    ^
  ../../../github/workspace/server/entitymanager/entitymanager_test.go:199:6: Error return value is not checked (errcheck)
  	em, _ := New("", a)
  	    ^
  ../../../github/workspace/server/entitymanager/entitymanager_test.go:408:6: Error return value is not checked (errcheck)
  	em, _ := New("", nil)
  	    ^
  ../../../github/workspace/server/server.go:57:21: Error return value of `s.httpSrv.Shutdown` is not checked (errcheck)
  		s.httpSrv.Shutdown(context.Background())
  		                  ^
  ../../../github/workspace/client/client.go:197:1: cyclomatic complexity 22 of func `main` is high (> 15) (gocyclo)
  func main() {
  ^
  ../../../github/workspace/client/client.go:242:47: G402: TLS InsecureSkipVerify may be true. (gosec)
  	tlsConfig := &tls.Config{InsecureSkipVerify: !*verifyTLSCert}
  	                                             ^
  ../../../github/workspace/client/client.go:352:15: G402: TLS MinVersion too low. (gosec)
  	tlsConfig = &tls.Config{
  		InsecureSkipVerify: false,
  		RootCAs:            trustCertPool,
  	}
  ../../../github/workspace/dhcp/plugins/bootz/bootz.go:59:46: G115: integer overflow conversion int -> uint16 (gosec)
  		b = binary.BigEndian.AppendUint16(b, uint16(len(u)))
  		                                           ^
  ../../../github/workspace/server/server.go:115:10: G402: TLS MinVersion too low. (gosec)
  	tls := &tls.Config{
  		Certificates: []tls.Certificate{*sa.TLSKeypair},
  		RootCAs:      trustBundle,
  	}
  ../../../github/workspace/server/server.go:170:10: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
  	srv := &http.Server{Addr: opt.Address, Handler: fs}
  	        ^
  ../../../github/workspace/client/client.go:292:6: shadow: declaration of "err" shadows declaration at line 209 (govet)
  		if err := validateArtifacts(controlCardState.GetSerialNumber(), resp); err != nil {
  		   ^
  ../../../github/workspace/client/client.go:298:5: shadow: declaration of "err" shadows declaration at line 209 (govet)
  	if err := proto.Unmarshal(resp.GetSerializedBootstrapData(), &signedResp); err != nil {
  	   ^
  ../../../github/workspace/client/client.go:317:10: shadow: declaration of "err" shadows declaration at line 209 (govet)
  		image, err := downloadImage(data.GetIntendedImage().GetUrl())
  		       ^
  ../../../github/workspace/server/entitymanager/entitymanager.go:152:5: shadow: declaration of "err" shadows declaration at line 147 (govet)
  	if err := prototext.Unmarshal(data, gnsiAuthzReq); err != nil {
  	   ^
  ../../../github/workspace/server/service/service.go:205:13: shadow: declaration of "err" shadows declaration at line 166 (govet)
  		bootdata, err := s.em.GetBootstrapData(ctx, chassis, v.GetSerialNumber())
  		          ^
  ../../../github/workspace/server/service/service.go:213:13: shadow: declaration of "err" shadows declaration at line 166 (govet)
  		bootdata, err := s.em.GetBootstrapData(ctx, chassis, chassisDesc.GetSerialNumber())
  		          ^
  ../../../github/workspace/server/server.go:120:2: ineffectual assignment to s (ineffassign)
  	s := &grpc.Server{}
  	^
  ../../../github/workspace/dhcp/dhcp.go:93:24: var-declaration: should drop = nil from declaration of var instance; it is the zero value (revive)
  var instance *Server = nil
                         ^
  ../../../github/workspace/dhcp/plugins/bootz/bootz.go:39:2: var-naming: don't use ALL_CAPS in Go names; use CamelCase (revive)
  	OPTION_V4_SZTP_REDIRECT uint8 = 143
  	^
  ../../../github/workspace/dhcp/plugins/bootz/bootz.go:40:2: var-naming: don't use ALL_CAPS in Go names; use CamelCase (revive)
  	OPTION_V6_SZTP_REDIRECT uint8 = 136
  	^
  ../../../github/workspace/server/entitymanager/entitymanager.go:60:48: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
  func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, lookup *service.EntityLookup, ccSerial string) (*service.Chassis, error) {
                                                 ^
  ../../../github/workspace/server/entitymanager/entitymanager.go:188:50: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
  func (m *InMemoryEntityManager) GetBootstrapData(ctx context.Context, chassis *service.Chassis, serial string) (*bpb.BootstrapDataResponse, error) {
                                                   ^
  ../../../github/workspace/server/entitymanager/entitymanager.go:324:74: redefines-builtin-id: redefinition of the built-in function new (revive)
  func (m *InMemoryEntityManager) ReplaceDevice(old *service.EntityLookup, new *epb.Chassis) error {
                                                                           ^
  ../../../github/workspace/server/service/service.go:301:42: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
  func (s *Service) SetDeviceConfiguration(ctx context.Context) error {
                                           ^
  ../../../github/workspace/client/client.go:181:36: SA1019: cc.GetSlot is deprecated: Marked as deprecated in github.com/openconfig/bootz/proto/bootz.proto. (staticcheck)
  			slotPopulated := populatedSlots[cc.GetSlot()]
  			                                ^
  ../../../github/workspace/client/client.go:183:94: SA1019: cc.GetSlot is deprecated: Marked as deprecated in github.com/openconfig/bootz/proto/bootz.proto. (staticcheck)
  				log.Exitf("Chassis validation error: slot %d already populated by another control card", cc.GetSlot())
  				                                                                                         ^
  ../../../github/workspace/client/client.go:185:19: SA1019: cc.GetSlot is deprecated: Marked as deprecated in github.com/openconfig/bootz/proto/bootz.proto. (staticcheck)
  			populatedSlots[cc.GetSlot()] = true
  			               ^
  ../../../github/workspace/server/entitymanager/entitymanager.go:175:37: unnecessary conversion (unconvert)
  		cliConf, err := os.ReadFile(string(conf.VendorConfigFile))
  		                                  ^
  ../../../github/workspace/server/emulator/main.go:36:2: var dhcpIntf is unused (unused)
  	dhcpIntf        = flag.String("dhcp_intf", "", "Network interface to use for dhcp server.")
  	^
  29 issues:
  * errcheck: 4
  * gocyclo: 1
  * gosec: 5
  * govet: 6
  * ineffassign: 1
  * revive: 7
  * staticcheck: 3
  * unconvert: 1
  * unused: 1
  0 issues.
  Linted: /github/workspace/proto/bootz
  0 issues.
  Linted: /github/workspace/server/entitymanager/proto/entity

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions