Skip to content

Commit

Permalink
Merge pull request #643 from jeremmfr/golangci-lint-v1.57
Browse files Browse the repository at this point in the history
tests: bump golangci lint to v1.57
  • Loading branch information
jeremmfr authored Mar 26, 2024
2 parents e3bb940 + 712c17c commit 39e15e1
Show file tree
Hide file tree
Showing 79 changed files with 823 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: 'v1.56.1'
version: 'v1.57.1'
args: -c .golangci.yml -v

markdown-lint:
Expand Down
35 changes: 33 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ run:
linters:
enable-all: true
disable:
# maligned # deprecated 1.38 but govet-fieldalignment not usuable
- maligned # deprecated 1.38
- interfacer # deprecated 1.38
- scopelint # deprecated 1.39
- golint # deprecated 1.41
- exhaustivestruct # deprecated 1.46
# ifshort deprecated 1.48 but no replacement
- ifshort # deprecated 1.48
- deadcode # deprecated 1.49
- structcheck # deprecated 1.49
- varcheck # deprecated 1.49
Expand Down Expand Up @@ -60,6 +60,37 @@ linters-settings:
disable:
- fieldalignment
- shadow
revive:
rules:
# defaults
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
- name: increment-decrement
- name: indent-error-flow
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: unreachable-code
- name: unused-parameter
- name: var-declaration
- name: var-naming
# additionals
- name: confusing-naming
- name: import-alias-naming
- name: import-shadowing
- name: unhandled-error
issues:
exclude-rules:
- text: "github.com/jeremmfr/terraform-provider-junos/internal"
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/eventoptions_generate_event.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ The following arguments are supported:

- **name** (Required, String, Forces new resource)
Name of the event to be generated.
- **no_drift** (Optional, Boolean)
Avoid event generation delay propagating to next event.
- **start_time** (Optional, String)
Start-time to generate event (YYYY-MM-DD.HH:MM:SS).
`time_interval` need to be set.
- **time_interval** (Optional, Number)
Frequency for generating the event (60..2592000 seconds).
- **time_of_day** (Optional, String)
Time of day at which to generate event (HH:MM:SS).
- **no_drift** (Optional, Boolean)
Avoid event generation delay propagating to next event.

## Attribute Reference

Expand Down
8 changes: 4 additions & 4 deletions docs/resources/forwardingoptions_sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ The following arguments are supported:
Disable sampled packet dumps.
- **files** (Optional, Number)
Maximum number of sampled packet dump files (2..10000).
- **no_stamp** (Optional, Boolean)
Don't timestamp every packet in the dump.
- **no_world_readable** (Optional, Boolean)
Don't allow any user to read the sampled dump.
- **size** (Optional, Number)
Maximum sample dump file size (1024..104857600).
- **stamp** (Optional, Boolean)
Timestamp every packet in the dump.
- **no_stamp** (Optional, Boolean)
Don't timestamp every packet in the dump.
- **world_readable** (Optional, Boolean)
Allow any user to read the sampled dump.
- **no_world_readable** (Optional, Boolean)
Don't allow any user to read the sampled dump.
- **flow_active_timeout** (Optional, Number)
Interval after which an active flow is exported (60..1800 seconds).
- **flow_inactive_timeout** (Optional, Number)
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ The following arguments are supported:
Maximum number of trace files (2..1000).
- **match** (Optional, String)
Regular expression for lines to be logged.
- **no_world_readable** (Optional, Boolean)
Don't allow any user to read the log file.
- **size** (Optional, Number)
Maximum trace file size (10240..1073741824).
- **world_readable** (Optional, Boolean)
Allow any user to read the log file.
- **no_world_readable** (Optional, Boolean)
Don't allow any user to read the log file.

---

Expand Down
24 changes: 12 additions & 12 deletions internal/junos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ const directoryPermission = 0o755

// Client information to connect on Junos Device and more.
type Client struct {
fakeUpdateAlso bool
fakeDeleteAlso bool
junosCommitConfirmed int
junosCommitConfirmedWaitPercent int
junosPort int
junosSSHTimeoutToEstab int
junosSSHRetryToEstab int
sleepLock int
sleepShort int
sleepSSHClosed int
filePermission int64
junosIP string
junosPort int
junosUserName string
junosPassword string
junosSSHKeyPEM string
junosSSHKeyFile string
junosSSHKeyPass string
groupIntDel string
sleepShort int
sleepLock int
junosCommitConfirmed int
junosCommitConfirmedWaitPercent int
sleepSSHClosed int
junosSSHCiphers []string
junosSSHTimeoutToEstab int
junosSSHRetryToEstab int
filePermission int64
logFileDst string
fakeCreateSetFile string
junosSSHCiphers []string
fakeUpdateAlso bool
fakeDeleteAlso bool
}

func NewClient(ip string) *Client {
Expand Down
2 changes: 1 addition & 1 deletion internal/junos/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ toretry:
}
s, err := netconf.NewSSHSession(conn, sshOpts.ClientConfig)
if err != nil {
conn.Close()
_ = conn.Close()
select {
case <-ctx.Done():
return nil, fmt.Errorf("initializing SSH session to %s: %w", host, err)
Expand Down
36 changes: 18 additions & 18 deletions internal/providerfwk/data_source_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,8 @@ func (dsc *applicationsDataSource) Schema(
type applicationsDataSourceData struct {
ID types.String `tfsdk:"id"`
MatchName types.String `tfsdk:"match_name"`
MatchOptions []applicationsDataSourceBlockMatchOptions `tfsdk:"match_options"`
Applications []applicationsDataSourceBlockApplications `tfsdk:"applications"`
}

type applicationsDataSourceBlockMatchOptions struct {
Alg types.String `tfsdk:"alg"`
ApplicationProtocol types.String `tfsdk:"application_protocol"`
DestinationPort types.String `tfsdk:"destination_port"`
EtherType types.String `tfsdk:"ether_type"`
IcmpCode types.String `tfsdk:"icmp_code"`
IcmpType types.String `tfsdk:"icmp_type"`
Icmp6Code types.String `tfsdk:"icmp6_code"`
Icmp6Type types.String `tfsdk:"icmp6_type"`
InactivityTimeout types.Int64 `tfsdk:"inactivity_timeout"`
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
Protocol types.String `tfsdk:"protocol"`
RPCRrogramNumber types.String `tfsdk:"rpc_program_number"`
SourcePort types.String `tfsdk:"source_port"`
UUID types.String `tfsdk:"uuid"`
MatchOptions []applicationsDataSourceBlockMatchOptions `tfsdk:"match_options"`
}

type applicationsDataSourceBlockApplications struct {
Expand Down Expand Up @@ -238,6 +221,23 @@ type applicationsDataSourceBlockApplicationsBlockTerm struct {
UUID types.String `tfsdk:"uuid"`
}

type applicationsDataSourceBlockMatchOptions struct {
Alg types.String `tfsdk:"alg"`
ApplicationProtocol types.String `tfsdk:"application_protocol"`
DestinationPort types.String `tfsdk:"destination_port"`
EtherType types.String `tfsdk:"ether_type"`
IcmpCode types.String `tfsdk:"icmp_code"`
IcmpType types.String `tfsdk:"icmp_type"`
Icmp6Code types.String `tfsdk:"icmp6_code"`
Icmp6Type types.String `tfsdk:"icmp6_type"`
InactivityTimeout types.Int64 `tfsdk:"inactivity_timeout"`
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
Protocol types.String `tfsdk:"protocol"`
RPCRrogramNumber types.String `tfsdk:"rpc_program_number"`
SourcePort types.String `tfsdk:"source_port"`
UUID types.String `tfsdk:"uuid"`
}

func (dsc *applicationsDataSource) Read(
ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse,
) {
Expand Down
2 changes: 1 addition & 1 deletion internal/providerfwk/data_source_interface_logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ func (dsc *interfaceLogicalDataSource) Schema(
}

type interfaceLogicalDataSourceData struct {
Disable types.Bool `tfsdk:"disable"`
ID types.String `tfsdk:"id"`
ConfigInterface types.String `tfsdk:"config_interface"`
Match types.String `tfsdk:"match"`
Name types.String `tfsdk:"name"`
Description types.String `tfsdk:"description"`
Disable types.Bool `tfsdk:"disable"`
RoutingInstance types.String `tfsdk:"routing_instance"`
SecurityInboundProtocols []types.String `tfsdk:"security_inbound_protocols"`
SecurityInboundServices []types.String `tfsdk:"security_inbound_services"`
Expand Down
16 changes: 8 additions & 8 deletions internal/providerfwk/data_source_interface_physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,29 +270,29 @@ func (dsc *interfacePhysicalDataSource) Schema(
}

type interfacePhysicalDataSourceData struct {
Disable types.Bool `tfsdk:"disable"`
FlexibleVlanTagging types.Bool `tfsdk:"flexible_vlan_tagging"`
GratuitousArpReply types.Bool `tfsdk:"gratuitous_arp_reply"`
NoGratuitousArpReply types.Bool `tfsdk:"no_gratuitous_arp_reply"`
NoGratuitousArpRequest types.Bool `tfsdk:"no_gratuitous_arp_request"`
Trunk types.Bool `tfsdk:"trunk"`
TrunkNonELS types.Bool `tfsdk:"trunk_non_els"`
VlanTagging types.Bool `tfsdk:"vlan_tagging"`
ID types.String `tfsdk:"id"`
ConfigInterface types.String `tfsdk:"config_interface"`
Match types.String `tfsdk:"match"`
Name types.String `tfsdk:"name"`
Description types.String `tfsdk:"description"`
Disable types.Bool `tfsdk:"disable"`
Encapsulation types.String `tfsdk:"encapsulation"`
FlexibleVlanTagging types.Bool `tfsdk:"flexible_vlan_tagging"`
GratuitousArpReply types.Bool `tfsdk:"gratuitous_arp_reply"`
NoGratuitousArpReply types.Bool `tfsdk:"no_gratuitous_arp_reply"`
HoldTimeDown types.Int64 `tfsdk:"hold_time_down"`
HoldTimeUp types.Int64 `tfsdk:"hold_time_up"`
LinkMode types.String `tfsdk:"link_mode"`
Mtu types.Int64 `tfsdk:"mtu"`
NoGratuitousArpRequest types.Bool `tfsdk:"no_gratuitous_arp_request"`
Speed types.String `tfsdk:"speed"`
StormControl types.String `tfsdk:"storm_control"`
Trunk types.Bool `tfsdk:"trunk"`
TrunkNonELS types.Bool `tfsdk:"trunk_non_els"`
VlanMembers []types.String `tfsdk:"vlan_members"`
VlanNative types.Int64 `tfsdk:"vlan_native"`
VlanNativeNonELS types.String `tfsdk:"vlan_native_non_els"`
VlanTagging types.Bool `tfsdk:"vlan_tagging"`
ESI *interfacePhysicalBlockESI `tfsdk:"esi"`
EtherOpts *interfacePhysicalBlockEtherOpts `tfsdk:"ether_opts"`
GigetherOpts *interfacePhysicalBlockEtherOpts `tfsdk:"gigether_opts"`
Expand Down
8 changes: 4 additions & 4 deletions internal/providerfwk/data_source_security_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,17 @@ func (dsc *securityZoneDataSource) Schema(
}

type securityZoneDataSourceData struct {
ApplicationTracking types.Bool `tfsdk:"application_tracking"`
ReverseReroute types.Bool `tfsdk:"reverse_reroute"`
SourceIdentityLog types.Bool `tfsdk:"source_identity_log"`
TCPRst types.Bool `tfsdk:"tcp_rst"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
AdvancePolicyBasedRoutingProfile types.String `tfsdk:"advance_policy_based_routing_profile"`
ApplicationTracking types.Bool `tfsdk:"application_tracking"`
Description types.String `tfsdk:"description"`
Screen types.String `tfsdk:"screen"`
InboundProtocols []types.String `tfsdk:"inbound_protocols"`
InboundServices []types.String `tfsdk:"inbound_services"`
ReverseReroute types.Bool `tfsdk:"reverse_reroute"`
SourceIdentityLog types.Bool `tfsdk:"source_identity_log"`
TCPRst types.Bool `tfsdk:"tcp_rst"`
AddressBook []securityZoneBlockAddressBook `tfsdk:"address_book"`
AddressBookDNS []securityZoneBlockAddressBookDNS `tfsdk:"address_book_dns"`
AddressBookRange []securityZoneBlockAddressBookRange `tfsdk:"address_book_range"`
Expand Down
24 changes: 12 additions & 12 deletions internal/providerfwk/resource_aggregate_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,41 +229,41 @@ func (rsc *aggregateRoute) Schema(
}

type aggregateRouteData struct {
Active types.Bool `tfsdk:"active"`
ASPathAtomicAggregate types.Bool `tfsdk:"as_path_atomic_aggregate"`
Brief types.Bool `tfsdk:"brief"`
Discard types.Bool `tfsdk:"discard"`
Full types.Bool `tfsdk:"full"`
Passive types.Bool `tfsdk:"passive"`
ID types.String `tfsdk:"id"`
Destination types.String `tfsdk:"destination"`
RoutingInstance types.String `tfsdk:"routing_instance"`
Active types.Bool `tfsdk:"active"`
ASPathAggregatorAddress types.String `tfsdk:"as_path_aggregator_address"`
ASPathAggregatorASNumber types.String `tfsdk:"as_path_aggregator_as_number"`
ASPathAtomicAggregate types.Bool `tfsdk:"as_path_atomic_aggregate"`
ASPathOrigin types.String `tfsdk:"as_path_origin"`
ASPathPath types.String `tfsdk:"as_path_path"`
Brief types.Bool `tfsdk:"brief"`
Community []types.String `tfsdk:"community"`
Discard types.Bool `tfsdk:"discard"`
Full types.Bool `tfsdk:"full"`
Metric types.Int64 `tfsdk:"metric"`
Passive types.Bool `tfsdk:"passive"`
Policy []types.String `tfsdk:"policy"`
Preference types.Int64 `tfsdk:"preference"`
}

type aggregateRouteConfig struct {
Active types.Bool `tfsdk:"active"`
ASPathAtomicAggregate types.Bool `tfsdk:"as_path_atomic_aggregate"`
Brief types.Bool `tfsdk:"brief"`
Discard types.Bool `tfsdk:"discard"`
Full types.Bool `tfsdk:"full"`
Passive types.Bool `tfsdk:"passive"`
ID types.String `tfsdk:"id"`
Destination types.String `tfsdk:"destination"`
RoutingInstance types.String `tfsdk:"routing_instance"`
Active types.Bool `tfsdk:"active"`
ASPathAggregatorAddress types.String `tfsdk:"as_path_aggregator_address"`
ASPathAggregatorASNumber types.String `tfsdk:"as_path_aggregator_as_number"`
ASPathAtomicAggregate types.Bool `tfsdk:"as_path_atomic_aggregate"`
ASPathOrigin types.String `tfsdk:"as_path_origin"`
ASPathPath types.String `tfsdk:"as_path_path"`
Brief types.Bool `tfsdk:"brief"`
Community types.List `tfsdk:"community"`
Discard types.Bool `tfsdk:"discard"`
Full types.Bool `tfsdk:"full"`
Metric types.Int64 `tfsdk:"metric"`
Passive types.Bool `tfsdk:"passive"`
Policy types.List `tfsdk:"policy"`
Preference types.Int64 `tfsdk:"preference"`
}
Expand Down
6 changes: 3 additions & 3 deletions internal/providerfwk/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@ func (rsc *application) Schema(
}

type applicationData struct {
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ApplicationProtocol types.String `tfsdk:"application_protocol"`
Description types.String `tfsdk:"description"`
DestinationPort types.String `tfsdk:"destination_port"`
EtherType types.String `tfsdk:"ether_type"`
InactivityTimeout types.Int64 `tfsdk:"inactivity_timeout"`
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
Protocol types.String `tfsdk:"protocol"`
RPCProgramNumber types.String `tfsdk:"rpc_program_number"`
SourcePort types.String `tfsdk:"source_port"`
Expand All @@ -316,14 +316,14 @@ type applicationData struct {
}

type applicationConfig struct {
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ApplicationProtocol types.String `tfsdk:"application_protocol"`
Description types.String `tfsdk:"description"`
DestinationPort types.String `tfsdk:"destination_port"`
EtherType types.String `tfsdk:"ether_type"`
InactivityTimeout types.Int64 `tfsdk:"inactivity_timeout"`
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
Protocol types.String `tfsdk:"protocol"`
RPCProgramNumber types.String `tfsdk:"rpc_program_number"`
SourcePort types.String `tfsdk:"source_port"`
Expand All @@ -332,7 +332,6 @@ type applicationConfig struct {
}

type applicationBlockTerm struct {
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
Name types.String `tfsdk:"name"`
Protocol types.String `tfsdk:"protocol"`
Alg types.String `tfsdk:"alg"`
Expand All @@ -342,6 +341,7 @@ type applicationBlockTerm struct {
Icmp6Code types.String `tfsdk:"icmp6_code"`
Icmp6Type types.String `tfsdk:"icmp6_type"`
InactivityTimeout types.Int64 `tfsdk:"inactivity_timeout"`
InactivityTimeoutNever types.Bool `tfsdk:"inactivity_timeout_never"`
RPCRrogramNumber types.String `tfsdk:"rpc_program_number"`
SourcePort types.String `tfsdk:"source_port"`
UUID types.String `tfsdk:"uuid"`
Expand Down
Loading

0 comments on commit 39e15e1

Please sign in to comment.