Repository: microsoft/moc
Pull request #351: enable lint
Author: login: raghavendra-nataraj
Created: 2025-04-18T22:47:00Z | Merged: 2025-04-22T17:17:46Z



Diff:
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 00000000..03614168
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,22 @@
+
+run:
+  timeout: 15m
+  tests: false  # Exclude test files from linting
+
+# Linter options and descriptions: https://golangci-lint.run/usage/linters/
+linters:
+  enable:
+    - errcheck
+    - govet
+    - ineffassign
+    - staticcheck
+  disable:
+    # Disabling these two default linters for now as their checks are not a priority
+    - gosimple
+    - unused
+
+linters-settings:
+  staticcheck:
+    checks:
+      - all
+      - -SA1019 # Ignore pkg deprecation warnings from staticcheck
\ No newline at end of file
diff --git a/.pipelines/build.yaml b/.pipelines/build.yaml
index b1c82aab..0d495bba 100644
--- a/.pipelines/build.yaml
+++ b/.pipelines/build.yaml
@@ -63,3 +63,47 @@ jobs:
 
   - publish: $(System.DefaultWorkingDirectory)/manifest
     artifact: manifest
+
+
+- job: Lint
+  displayName: 'Lint'
+
+  pool:
+    vmImage: 'ubuntu-latest'
+
+  variables:
+  - group: moc-build
+  - name: GO111MODULE
+    value: 'on'
+
+  steps:
+  - task: GoTool@0
+    inputs:
+      version: '1.22.5'
+
+  - task: InstallSSHKey@0
+    inputs:
+      knownHostsEntry: |
+        $(KNOWN_HOST_GITHUB)
+        $(KNOWN_HOST_GITHUB_ECDSA)
+        $(KNOWN_HOST_GITHUB_Ed25519)
+      sshPublicKey: '$(SSH_PUBLIC_KEY)'
+      sshKeySecureFile: 'azure-pipelines-ssh-key-new'
+
+  - task: AzureCLI@2
+    inputs:
+      azureSubscription: 'kva-azuredevops-gcm'
+      scriptType: 'bash'
+      scriptLocation: 'inlineScript'
+      inlineScript: |
+        # Obtain Azure DevOps access token
+        aadToken=$(az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv)
+        # Set git configuration for authentication
+        git config --global http.extraheader "AUTHORIZATION: bearer $aadToken"
+        git config --global url."ssh://git@github.com/".insteadOf "https://github.com/"
+    displayName: 'Set git config'
+
+  - script: |
+      make golangci-lint
+    displayName: 'Run GolangCI-Lint'
+    workingDirectory: '$(System.DefaultWorkingDirectory)'
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 5bbef6bc..20f8c71d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ GOBUILD=$(GOCMD) build -v #-mod=vendor
 GOTEST=$(GOCMD) test -v 
 GOHOSTOS=$(strip $(shell $(GOCMD) env get GOHOSTOS))
 MOCKGEN=$(shell command -v mockgen 2> /dev/null)
+GOPATH_BIN := $(shell go env GOPATH)/bin
 
 # Private repo workaround
 export GOPRIVATE = github.com/microsoft
@@ -51,3 +52,7 @@ mocks:
 	go get github.com/golang/mock@v1.6.0
 	go generate ./...
 
+
+golangci-lint:
+	$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
+	$(GOPATH_BIN)/golangci-lint run --config .golangci.yml
\ No newline at end of file
diff --git a/pkg/auth/auth_env.go b/pkg/auth/auth_env.go
index c896f6d9..be56bdeb 100644
--- a/pkg/auth/auth_env.go
+++ b/pkg/auth/auth_env.go
@@ -87,7 +87,7 @@ func GetWssdConfigLocation() string {
 	if execName, err := getExecutableName(); err == nil {
 		defaultPath = filepath.Join(defaultPath, execName)
 	}
-	os.MkdirAll(defaultPath, os.ModePerm)
+	os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
 	accessFilePath := filepath.Join(defaultPath, AccessFileDefaultName)
 	return accessFilePath
 }
@@ -108,7 +108,7 @@ func GetMocConfigLocationName(subfolder, filename string) string {
 		// Create the default config path and set the
 		// env variable
 		defaultPath := filepath.Join(wd, DefaultWSSDFolder, subfolder)
-		os.MkdirAll(defaultPath, os.ModePerm)
+		os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
 		wssdConfigPath = filepath.Join(defaultPath, file)
 		os.Setenv(WssdConfigPath, wssdConfigPath)
 	}
@@ -126,7 +126,7 @@ func getClientTokenLocation() string {
 		// Create the default token path and set the
 		// env variable
 		defaultPath := filepath.Join(wd, DefaultWSSDFolder)
-		os.MkdirAll(defaultPath, os.ModePerm)
+		os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
 		clientTokenPath = filepath.Join(defaultPath, ClientTokenName)
 		os.Setenv(ClientTokenPath, clientTokenPath)
 	}
diff --git a/pkg/auth/utils.go b/pkg/auth/utils.go
index c867155e..4e7a8e6a 100644
--- a/pkg/auth/utils.go
+++ b/pkg/auth/utils.go
@@ -66,7 +66,7 @@ func GenerateClientCsr(loginconfig LoginConfig) (string, WssdConfig, error) {
 	if err != nil {
 		return "", WssdConfig{}, err
 	}
-	accessFile, err := readAccessFile(GetWssdConfigLocation())
+	accessFile, err := readAccessFile(GetWssdConfigLocation()) //nolint:golint,ineffassign,staticcheck
 	cloudAgentIpAddress, err := wssdnet.GetIPAddress()
 	if err != nil {
 		return "", WssdConfig{}, err
diff --git a/pkg/certs/certificateAuthority.go b/pkg/certs/certificateAuthority.go
index 6229aa2b..92c17141 100644
--- a/pkg/certs/certificateAuthority.go
+++ b/pkg/certs/certificateAuthority.go
@@ -175,7 +175,7 @@ func (ca *CertificateAuthority) SignRequest(csrPem []byte, oldCertPem []byte, co
 		if err = ca.VerifyClientCertificate([][]byte{oldCertPem}); err != nil {
 			return nil, errors.Wrapf(errors.InvalidInput, "Old certificate verification failed : %v", err)
 		}
-		oldCert, err = DecodeCertPEM(oldCertPem)
+		oldCert, err = DecodeCertPEM(oldCertPem) //nolint:golint,ineffassign,staticcheck
 	}
 	err = csr.CheckSignature()
 	if err != nil {
@@ -302,7 +302,7 @@ func (ca *CertificateAuthority) SignRequest(csrPem []byte, oldCertPem []byte, co
 			if ext.Id.Equal(oidOriginalCertificate) {
 				origCertDER = ext.Value
 			} else if ext.Id.Equal(oidRenewCount) {
-				asn1.Unmarshal(ext.Value, &renewCount)
+				asn1.Unmarshal(ext.Value, &renewCount) //nolint:golint,errcheck
 			}
 		}
 
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 879ac8d8..7cd518c6 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -154,7 +154,7 @@ func MarshalOutput(data interface{}, query string, outputType string) ([]byte, e
 	if err != nil {
 		return nil, err
 	}
-	marshal.FromJSONBytes(jsonByte, &queryTarget)
+	marshal.FromJSONBytes(jsonByte, &queryTarget) //nolint:golint,errcheck
 	if query != "" {
 		result, err = jmespath.Search(query, queryTarget)
 		if err != nil {
diff --git a/pkg/logging/loggingRedirect.go b/pkg/logging/loggingRedirect.go
index 44f7f8f8..fb250e09 100644
--- a/pkg/logging/loggingRedirect.go
+++ b/pkg/logging/loggingRedirect.go
@@ -20,7 +20,7 @@ var (
 
 func createLogFile(logFileAbsolutePath string, logFileName string) (*os.File, error) {
 	// Create log path
-	os.MkdirAll(logFileAbsolutePath, os.ModeDir)
+	os.MkdirAll(logFileAbsolutePath, os.ModeDir) //nolint:golint,errcheck
 
 	err := path.CheckPath(logFileAbsolutePath)
 	if err != nil {
@@ -40,7 +40,7 @@ func createLogFile(logFileAbsolutePath string, logFileName string) (*os.File, er
 	// If there are contents in the file already, move the file and replace it.
 	if st.Size() > 0 {
 		logFile.Close()
-		os.Rename(path, path+".old")
+		os.Rename(path, path+".old") //nolint:golint,errcheck
 		logFile, err = os.Create(path)
 		if err != nil {
 			return nil, err
diff --git a/pkg/logging/redirectstderr_linux.go b/pkg/logging/redirectstderr_linux.go
index dcbc915a..1bca3fc4 100644
--- a/pkg/logging/redirectstderr_linux.go
+++ b/pkg/logging/redirectstderr_linux.go
@@ -9,8 +9,6 @@ import (
 )
 
 func RedirectStdErr(file *os.File) {
-	err := syscall.Dup3(int(file.Fd()), int(os.Stderr.Fd()), 0)
-	if err != nil {
-	}
+	syscall.Dup3(int(file.Fd()), int(os.Stderr.Fd()), 0) //nolint:golint,errcheck
 	return
 }
diff --git a/pkg/status/status.go b/pkg/status/status.go
index bb527d93..8712b735 100644
--- a/pkg/status/status.go
+++ b/pkg/status/status.go
@@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.ProvisioningStatus = ps
 	}
 	if val, ok := statuses["HealthState"]; ok {
 		ps := new(common.Health)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.Health = ps
 	}
 	if val, ok := statuses["Error"]; ok {
 		ps := new(common.Error)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.LastError = ps
 	}
 	if val, ok := statuses["DownloadStatus"]; ok {
 		ps := new(common.DownloadStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.DownloadStatus = ps
 	}
 	if val, ok := statuses["PlacementStatus"]; ok {
 		ps := new(common.PlacementStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.PlacementStatus = ps
 	}
 	if val, ok := statuses["UploadStatus"]; ok {


Reviews:
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This PR enables linting by adding nolint comments to various function calls that previously lacked error handling and updating pipeline configurations to integrate linting steps.  
- Adds nolint comments on error-check related function calls in multiple packages.  
- Updates build pipeline configuration to include a dedicated lint job and linting tool settings.  
- Introduces a golangci-lint configuration file to control lint behavior.

### Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 15 comments.

<details>
<summary>Show a summary per file</summary>

| File                                   | Description                                                                             |
| -------------------------------------- | --------------------------------------------------------------------------------------- |
| pkg/status/status.go                   | Added nolint comments to proto.UnmarshalText calls in multiple status fields.           |
| pkg/logging/redirectstderr_linux.go    | Added nolint comment on syscall.Dup3 call to suppress error check warnings.              |
| pkg/logging/loggingRedirect.go         | Added nolint comments for os.MkdirAll and os.Rename calls to suppress lint warnings.       |
| pkg/config/config.go                   | Added nolint comment on marshal.FromJSONBytes call to ignore errcheck lint warning.        |
| pkg/certs/certificateAuthority.go      | Added nolint comments for DecodeCertPEM and asn1.Unmarshal calls to suppress lint errors.  |
| pkg/auth/utils.go                      | Added nolint comment on readAccessFile call to suppress lint warnings on error checking.   |
| pkg/auth/auth_env.go                   | Added nolint comments on multiple os.MkdirAll calls to suppress lint warnings.             |
| .pipelines/build.yaml                  | Updated pipeline to include a lint job with Go tooling and Azure CLI configuration.        |
| .golangci.yml                          | Introduced golangci-lint configuration to define and control linter behavior.              |
</details>


<details>
<summary>Files not reviewed (1)</summary>

* **Makefile**: Language not supported
</details>



state: COMMENTED
author_association: NONE
submitted_at: 2025-04-18T23:50:36Z
user: login: msftpgayam
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T00:44:54Z
user: login: madhanrm
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-22T15:53:58Z

Review comments:
diff_hunk: @@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
path: pkg/status/status.go
user: login: Copilot
body: Ignoring the error returned by proto.UnmarshalText may hide potential unmarshalling issues. Consider handling the error explicitly or provide a clear justification comment for suppressing the check.
created_at: 2025-04-18T23:50:32Z
author_association: NONE
diff_hunk: @@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.ProvisioningStatus = ps
 	}
 	if val, ok := statuses["HealthState"]; ok {
 		ps := new(common.Health)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
path: pkg/status/status.go
user: login: Copilot
body: Ignoring the error returned by proto.UnmarshalText could lead to unexpected behavior. Consider adding error handling or a detailed comment noting why it is safe to ignore.
created_at: 2025-04-18T23:50:33Z
author_association: NONE
diff_hunk: @@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.ProvisioningStatus = ps
 	}
 	if val, ok := statuses["HealthState"]; ok {
 		ps := new(common.Health)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.Health = ps
 	}
 	if val, ok := statuses["Error"]; ok {
 		ps := new(common.Error)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
path: pkg/status/status.go
user: login: Copilot
body: The error from proto.UnmarshalText is suppressed; ensure that this neglect is intentional and that potential failures are acceptable.
created_at: 2025-04-18T23:50:33Z
author_association: NONE
diff_hunk: @@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.ProvisioningStatus = ps
 	}
 	if val, ok := statuses["HealthState"]; ok {
 		ps := new(common.Health)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.Health = ps
 	}
 	if val, ok := statuses["Error"]; ok {
 		ps := new(common.Error)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.LastError = ps
 	}
 	if val, ok := statuses["DownloadStatus"]; ok {
 		ps := new(common.DownloadStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
path: pkg/status/status.go
user: login: Copilot
body: Suppressing the error check for proto.UnmarshalText might hide issues during unmarshalling. Consider handling or logging the error if the data is unexpected.
created_at: 2025-04-18T23:50:33Z
author_association: NONE
diff_hunk: @@ -197,27 +197,27 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
 	status = &common.Status{}
 	if val, ok := statuses["ProvisionState"]; ok {
 		ps := new(common.ProvisionStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.ProvisioningStatus = ps
 	}
 	if val, ok := statuses["HealthState"]; ok {
 		ps := new(common.Health)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.Health = ps
 	}
 	if val, ok := statuses["Error"]; ok {
 		ps := new(common.Error)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.LastError = ps
 	}
 	if val, ok := statuses["DownloadStatus"]; ok {
 		ps := new(common.DownloadStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
 		status.DownloadStatus = ps
 	}
 	if val, ok := statuses["PlacementStatus"]; ok {
 		ps := new(common.PlacementStatus)
-		proto.UnmarshalText(*val, ps)
+		proto.UnmarshalText(*val, ps) //nolint:golint,errcheck
path: pkg/status/status.go
user: login: Copilot
body: By suppressing the error from proto.UnmarshalText, any unmarshalling failure may go unnoticed. Consider adding explicit error handling or rationale for suppression.
created_at: 2025-04-18T23:50:33Z
author_association: NONE
diff_hunk: @@ -9,8 +9,6 @@ import (
 )
 
 func RedirectStdErr(file *os.File) {
-	err := syscall.Dup3(int(file.Fd()), int(os.Stderr.Fd()), 0)
-	if err != nil {
-	}
+	syscall.Dup3(int(file.Fd()), int(os.Stderr.Fd()), 0) //nolint:golint,errcheck
path: pkg/logging/redirectstderr_linux.go
user: login: Copilot
body: Suppressing the error from syscall.Dup3 might mask issues with duplicating file descriptors. Consider handling the error, even if only logging it.
created_at: 2025-04-18T23:50:34Z
author_association: NONE
diff_hunk: @@ -20,7 +20,7 @@ var (
 
 func createLogFile(logFileAbsolutePath string, logFileName string) (*os.File, error) {
 	// Create log path
-	os.MkdirAll(logFileAbsolutePath, os.ModeDir)
+	os.MkdirAll(logFileAbsolutePath, os.ModeDir) //nolint:golint,errcheck
path: pkg/logging/loggingRedirect.go
user: login: Copilot
body: Ignoring the error from os.MkdirAll may allow directory creation failures to go undetected. Consider handling or logging errors from this call.
```suggestion
	if err := os.MkdirAll(logFileAbsolutePath, os.ModeDir); err != nil {
		return nil, err
	}
```
created_at: 2025-04-18T23:50:34Z
author_association: NONE
diff_hunk: @@ -40,7 +40,7 @@ func createLogFile(logFileAbsolutePath string, logFileName string) (*os.File, er
 	// If there are contents in the file already, move the file and replace it.
 	if st.Size() > 0 {
 		logFile.Close()
-		os.Rename(path, path+".old")
+		os.Rename(path, path+".old") //nolint:golint,errcheck
path: pkg/logging/loggingRedirect.go
user: login: Copilot
body: Suppressing the error from os.Rename could result in unnoticed failures during file renaming. Consider adding error handling or a comment explaining why it is safe to ignore.
```suggestion
		err := os.Rename(path, path+".old")
		if err != nil {
			log.Printf("Warning: Failed to rename log file %s to %s.old: %v", path, path, err)
			// Proceeding to create a new log file despite the renaming failure
		}
```
created_at: 2025-04-18T23:50:34Z
author_association: NONE
diff_hunk: @@ -154,7 +154,7 @@ func MarshalOutput(data interface{}, query string, outputType string) ([]byte, e
 	if err != nil {
 		return nil, err
 	}
-	marshal.FromJSONBytes(jsonByte, &queryTarget)
+	marshal.FromJSONBytes(jsonByte, &queryTarget) //nolint:golint,errcheck
path: pkg/config/config.go
user: login: Copilot
body: By suppressing the error from marshal.FromJSONBytes, potential JSON unmarshalling issues may be overlooked. It is advisable to handle the error explicitly or provide a detailed justification.
```suggestion
	err = marshal.FromJSONBytes(jsonByte, &queryTarget)
	if err != nil {
		return nil, err
	}
```
created_at: 2025-04-18T23:50:34Z
author_association: NONE
diff_hunk: @@ -175,7 +175,7 @@ func (ca *CertificateAuthority) SignRequest(csrPem []byte, oldCertPem []byte, co
 		if err = ca.VerifyClientCertificate([][]byte{oldCertPem}); err != nil {
 			return nil, errors.Wrapf(errors.InvalidInput, "Old certificate verification failed : %v", err)
 		}
-		oldCert, err = DecodeCertPEM(oldCertPem)
+		oldCert, err = DecodeCertPEM(oldCertPem) //nolint:golint,ineffassign,staticcheck
path: pkg/certs/certificateAuthority.go
user: login: Copilot
body: Suppressing the error returned from DecodeCertPEM might hide issues with certificate decoding. Consider handling the error appropriately or including a rationale comment.
```suggestion
		oldCert, err = DecodeCertPEM(oldCertPem)
		if err != nil {
			return nil, errors.Wrapf(errors.InvalidInput, "Failed to decode old certificate: %v", err)
		}
```
created_at: 2025-04-18T23:50:35Z
author_association: NONE
diff_hunk: @@ -302,7 +302,7 @@ func (ca *CertificateAuthority) SignRequest(csrPem []byte, oldCertPem []byte, co
 			if ext.Id.Equal(oidOriginalCertificate) {
 				origCertDER = ext.Value
 			} else if ext.Id.Equal(oidRenewCount) {
-				asn1.Unmarshal(ext.Value, &renewCount)
+				asn1.Unmarshal(ext.Value, &renewCount) //nolint:golint,errcheck
path: pkg/certs/certificateAuthority.go
user: login: Copilot
body: Ignoring the error from asn1.Unmarshal may cause unexpected behavior if the data is malformed. Consider handling the error instead of suppressing it.
created_at: 2025-04-18T23:50:35Z
author_association: NONE
diff_hunk: @@ -66,7 +66,7 @@ func GenerateClientCsr(loginconfig LoginConfig) (string, WssdConfig, error) {
 	if err != nil {
 		return "", WssdConfig{}, err
 	}
-	accessFile, err := readAccessFile(GetWssdConfigLocation())
+	accessFile, err := readAccessFile(GetWssdConfigLocation()) //nolint:golint,ineffassign,staticcheck
path: pkg/auth/utils.go
user: login: Copilot
body: Suppressing the error from readAccessFile might allow issues with file access to go undetected. Consider adding error handling or logging to cover possible failures.
```suggestion
	accessFile, err := readAccessFile(GetWssdConfigLocation())
	if err != nil {
		log.Printf("Error reading access file: %v", err)
		accessFile = WssdConfig{}
	}
```
created_at: 2025-04-18T23:50:35Z
author_association: NONE
diff_hunk: @@ -87,7 +87,7 @@ func GetWssdConfigLocation() string {
 	if execName, err := getExecutableName(); err == nil {
 		defaultPath = filepath.Join(defaultPath, execName)
 	}
-	os.MkdirAll(defaultPath, os.ModePerm)
+	os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
path: pkg/auth/auth_env.go
user: login: Copilot
body: Ignoring the error from os.MkdirAll may lead to unnoticed failures when creating directories. Consider handling or logging the error for better robustness.
```suggestion
	if err := os.MkdirAll(defaultPath, os.ModePerm); err != nil {
		return "", err
	}
```
created_at: 2025-04-18T23:50:35Z
author_association: NONE
diff_hunk: @@ -108,7 +108,7 @@ func GetMocConfigLocationName(subfolder, filename string) string {
 		// Create the default config path and set the
 		// env variable
 		defaultPath := filepath.Join(wd, DefaultWSSDFolder, subfolder)
-		os.MkdirAll(defaultPath, os.ModePerm)
+		os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
path: pkg/auth/auth_env.go
user: login: Copilot
body: Suppressing the error from os.MkdirAll can hide directory creation issues. It is recommended to handle the error or document why it is safe to ignore.
```suggestion
		if err := os.MkdirAll(defaultPath, os.ModePerm); err != nil {
			panic("failed to create directory: " + err.Error())
		}
```
created_at: 2025-04-18T23:50:36Z
author_association: NONE
diff_hunk: @@ -126,7 +126,7 @@ func getClientTokenLocation() string {
 		// Create the default token path and set the
 		// env variable
 		defaultPath := filepath.Join(wd, DefaultWSSDFolder)
-		os.MkdirAll(defaultPath, os.ModePerm)
+		os.MkdirAll(defaultPath, os.ModePerm) //nolint:golint,errcheck
path: pkg/auth/auth_env.go
user: login: Copilot
body: The error from os.MkdirAll is suppressed, which might lead to undetected failures in setting up the required directory structure. Consider handling the error explicitly.
```suggestion
		if err := os.MkdirAll(defaultPath, os.ModePerm); err != nil {
			panic(err)
		}
```
created_at: 2025-04-18T23:50:36Z
author_association: NONE

PR comments:
user: login: raghavendra-nataraj
created_at: 2025-04-18T22:50:11Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-04-18T22:50:21Z
body: <samp>
Azure Pipelines successfully started running 1 pipeline(s).<br>

</samp>
author_association: NONE
user: login: raghavendra-nataraj
created_at: 2025-04-18T23:21:54Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-04-18T23:22:03Z
body: <samp>
Azure Pipelines successfully started running 1 pipeline(s).<br>

</samp>
author_association: NONE
user: login: raghavendra-nataraj
created_at: 2025-04-18T23:31:20Z
body: /azp run
author_association: CONTRIBUTOR
user: login: azure-pipelines[bot]
created_at: 2025-04-18T23:31:30Z
body: <samp>
Azure Pipelines successfully started running 1 pipeline(s).<br>

</samp>
author_association: NONE