Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ linters:
- revive
- staticcheck
- unused
- tagliatelle
settings:
gosec:
excludes:
Expand All @@ -37,6 +38,141 @@ linters:
- name: superfluous-else
- name: var-declaration
- name: duplicated-imports

tagliatelle:
case:
rules:
json: goCamel
yaml: goCamel
overrides:

- pkg: test
ignore: true
#Format for ignored-fields comments - current : expected
- pkg: pkg/ovs/ovsconfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be ignored as well. We don't control the tags, they are based on the OVSDB schema.

ignored-fields:
- DatapathType # datapath_type : datapathType
- ExternalIDs # external_ids : externalIDs
- McastSnoopingEnable # mcast_snooping_enable : mcastSnoopingEnable
- OFPortRequest # ofport_request : ofPortRequest

- pkg: pkg/flowaggregator/apis
ignored-fields:
- WithIPFIXExporter # withIPFIXExporter : withIpfixExporter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add IPFIX as an initialism, or did you say it was not working?

Copy link
Author

@KishanPipariya KishanPipariya Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the following snippet but it did not work out.
Snippet:

Extended-rules:
   yaml:
       case: goCamel
       extra-initialisms: true
       initialism-overrides:
          IFPIX: true
          IPAM: true

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also asked the folks at tagliatelle, to see if it's a error from my end or there is a problem with the linter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a response from their end: ldez/tagliatelle#30 (comment)

I will try resolving it from my end and if it is not possible, raise an issue for tagliatelle.


- pkg: pkg/config/flowaggregator
ignored-fields:
- MaxIPFIXMsgSize # maxIPFIXMsgSize : maxIpfixMsgSize

- pkg: pkg/config/controller
ignored-fields:
- ClientCAFile # clientCAFile : clientCaFile
- ClusterCIDRs # clusterCIDRs : clusterCidRs
Comment on lines +69 to +70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CA & CIDR should also be added as initialisms

- EnableNodeIPAM # enableNodeIPAM : enableNodeIpam
- IPsecCSRSignerConfig # ipsecCSRSigner : iPsecCsrSignerConfig
- NodeCIDRMaskSizeIPv4 # nodeCIDRMaskSizeIPv4 : nodeCidrMaskSizeIPv4
- NodeCIDRMaskSizeIPv6 # nodeCIDRMaskSizeIPv6 : nodeCidrMaskSizeIPv6
- NodeIPAM # nodeIPAM : nodeIpam
- SelfSignedCA # selfSignedCA : selfSignedCa
- ServiceCIDR # serviceCIDR : serviceCidr
- ServiceCIDRv6 # serviceCIDRv6 : serviceCidRv6

- pkg: pkg/config/agent
ignored-fields:
- ClusterMembershipPort # clusterPort : clusterMembershipPort
- DefaultMTU # defaultMTU : defaultMtu
- DisableTXChecksumOffload # disableTXChecksumOffload : disableTxChecksumOffload
- ExceptCIDRs # exceptCIDRs : exceptCidRs
- IPsec # ipsec : iPsec
- NoSNAT # noSNAT : noSnat
- ServiceCIDR # serviceCIDR : serviceCidr
- ServiceCIDRv6 # serviceCIDRv6 : serviceCidRv6
- TransportInterfaceCIDRs # transportInterfaceCIDRs : transportInterfaceCidR

- pkg: pkg/apiserver/apis
ignored-fields:
- AppliedPolicies # policies : appliedPolicies
- EgressDstRules # gressdstrules : egressDstRules
- IngressSrcRules # ingresssrcrules : ingressSrcRules
- PolicyRef # policyref' want 'policyRef
- RuleIndex # ruleindex : ruleIndex

- pkg: pkg/apis/system
ignored-fields:
- ObjectMeta # metadata : objectMeta

- pkg: pkg/apis/stats
ignored-fields:
- LastMeasuredRTTNanoseconds # lastMeasuredRTTNanoseconds : lastMeasuredRttNanoseconds
- ListMeta # metadata : listMeta
- ObjectMeta # metadata : objectMeta

- pkg: pkg/apis/crd
ignored-fields:
- APICABundle # apiCABundle : apicaBundle
- DstMAC # dstMAC : dstMac
- IPv6Header # 'ipv6Header : iPv6Header'
- ListMeta # metadata : listMeta
- LocalASN # localASN : localAsn
- MemberASNs # memberASNs : memberAsNs
- ObjectMeta # metadata : objectMeta

- pkg: pkg/apis/controlplane
ignored-fields:
- ListMeta # metadata : listMeta
- ObjectMeta # metadata : objectMeta

- pkg: pkg/antctl/raw
ignored-fields:
- IPv6Header # 'ipv6Header : iPv6Header'
- NodeResults # results : nodeResults
- TransportHeader # tranportHeader : transportHeader

- pkg: pkg/agent/flowexporter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whole package be ignored as well, we don't control these names

ignored-fields:
- ContentLength # length : contentLength
- ContentType # http_content_type : contentType
- DestIP # dest_ip : destIP
- DestPort # dest_port : destPort
- EventType # event_type : eventType
- FlowID # flow_id : flowID
- InInterface # in_iface : inInterface
- Method # http_method : method
- SrcIP # src_ip : srcIP
- SrcPort # src_port : srcPort
- TxID # tx_id : txID
- UserAgent # http_user_agent : userAgent

- pkg: pkg/agent/cniserver
ignored-fields:
- IPPools # ippools : ipPools
- Nameservers # servers : nameservers
- RawPrevResult # prevResult : rawPrevResult
- Search # searches : search

- pkg: pkg/agent/apis
ignored-fields:
- BGPPolicyName # name' want 'bgpPolicyName
- IPs # ips : iPs
- LocalASN # localASN : localAsn
- MemberASNs # memberASNs : memberAsNs
- Nameservers # servers : nameservers
- PodName # name' want 'podName

- pkg: multicluster/apis/multicluster
ignored-fields:
- ListMeta # metadata : listMeta
- ObjectMeta # metadata : objectMeta
- PodCIDRs # podCIDRs : podCidRs
- ServiceCIDR # serviceCIDR : serviceCidr

- pkg: pkg/agent/util
ignored-fields:
- Extensions # Extensions : extensions
- ExtensionID # Id : extensionID
Comment on lines +169 to +172
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I don't think we control or can change these tags

BTW, it may be better to add //nolint:tagliatelle on struct definitions for which we don't have control over the tags. Can you check if it works?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify a bit about //nolint:tagliatelle and where to place it? Also are agent and ovs the only packages not in our control?

Copy link
Author

@KishanPipariya KishanPipariya Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get the extra-initialisms to work for Antrea. I tried the same yaml config on small dummy programs and it worked. So I am trying to figure out what's causing this issue.


use-field-name: true

exclusions:
presets:
- legacy
Expand Down