Skip to content

Commit 32d8a85

Browse files
Fix linting issues: address unused receiver parameters
- agent/internal/posture/linux.go: Convert checkUFW to package function since receiver was unused - agent/internal/posture/windows.go: Use underscore receivers for unused method receivers - agent/internal/posture/default.go: Use underscore receiver for unused method receiver - agent/internal/service/service.go: Use underscore receiver for unused daemonize method receiver These changes address golangci-lint warnings about unused receivers while maintaining the existing API contracts where methods are expected. Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-5be4213f-26eb-400c-bb7b-d4c79b7ee6fe
1 parent a8c2e00 commit 32d8a85

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

agent/internal/posture/default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "runtime"
66
type DefaultCollector struct{}
77

88
// CollectPosture returns minimal posture information for unsupported platforms
9-
func (*DefaultCollector) CollectPosture() (*DevicePosture, error) {
9+
func (_ *DefaultCollector) CollectPosture() (*DevicePosture, error) {
1010
posture := &DevicePosture{
1111
OS: OperatingSystem{
1212
Name: UnknownValue,

agent/internal/posture/linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (c *LinuxCollector) collectOSInfo(os *OperatingSystem) error {
8181
// collectFirewallStatus checks UFW and iptables status
8282
func (c *LinuxCollector) collectFirewallStatus(fw *FirewallStatus) error {
8383
// Check UFW first
84-
if c.checkUFW(fw) {
84+
if checkUFW(fw) {
8585
return nil
8686
}
8787

@@ -90,7 +90,7 @@ func (c *LinuxCollector) collectFirewallStatus(fw *FirewallStatus) error {
9090
}
9191

9292
// checkUFW checks Ubuntu UFW firewall status
93-
func (*LinuxCollector) checkUFW(fw *FirewallStatus) bool {
93+
func checkUFW(fw *FirewallStatus) bool {
9494
output, err := runCommand("ufw", "status")
9595
if err != nil {
9696
return false

agent/internal/posture/windows.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (c *WindowsCollector) collectOSInfo(os *OperatingSystem) error {
8282
}
8383

8484
// collectFirewallStatus checks Windows Defender Firewall status
85-
func (*WindowsCollector) collectFirewallStatus(fw *FirewallStatus) error {
85+
func (_ *WindowsCollector) collectFirewallStatus(fw *FirewallStatus) error {
8686
fw.Service = "Windows Defender Firewall"
8787

8888
// Check firewall state using netsh
@@ -113,7 +113,7 @@ func (*WindowsCollector) collectFirewallStatus(fw *FirewallStatus) error {
113113
}
114114

115115
// checkAntiVirus checks Windows Defender and other antivirus software
116-
func (*WindowsCollector) checkAntiVirus() bool {
116+
func (_ *WindowsCollector) checkAntiVirus() bool {
117117
// Check Windows Defender status
118118
output, err := runCommand(powershellCmd, powershellFlag, "Get-MpComputerStatus | Select-Object AntivirusEnabled")
119119
if err == nil && strings.Contains(strings.ToLower(output), "true") {
@@ -136,7 +136,7 @@ func (*WindowsCollector) checkAntiVirus() bool {
136136
}
137137

138138
// checkSystemUpdated checks Windows Update status
139-
func (*WindowsCollector) checkSystemUpdated() bool {
139+
func (_ *WindowsCollector) checkSystemUpdated() bool {
140140
// Check for pending updates using PowerShell
141141
output, err := runCommand(powershellCmd, powershellFlag,
142142
"Get-WUList -MicrosoftUpdate | Measure-Object | Select-Object -ExpandProperty Count")
@@ -155,7 +155,7 @@ func (*WindowsCollector) checkSystemUpdated() bool {
155155
}
156156

157157
// checkDiskEncryption checks BitLocker status
158-
func (*WindowsCollector) checkDiskEncryption() bool {
158+
func (_ *WindowsCollector) checkDiskEncryption() bool {
159159
// Check BitLocker status
160160
output, err := runCommand("manage-bde", "-status")
161161
if err != nil {
@@ -167,7 +167,7 @@ func (*WindowsCollector) checkDiskEncryption() bool {
167167
}
168168

169169
// checkScreenLock checks screen lock/password policy
170-
func (*WindowsCollector) checkScreenLock() bool {
170+
func (_ *WindowsCollector) checkScreenLock() bool {
171171
// Check screen saver settings
172172
output, err := runCommand("reg", "query",
173173
"HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Windows\\Control Panel\\Desktop",

agent/internal/service/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ func (s *Service) removePIDFile() {
432432
}
433433

434434
// daemonize runs the process in background (Unix-like systems)
435-
func (*Service) daemonize() error {
435+
func (_ *Service) daemonize() error {
436436
// This is a simplified daemonization
437437
// In production, you might want to use proper daemon libraries
438438
// or systemd service files

0 commit comments

Comments
 (0)