Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Replace hardcoded strings with constants and update dependencies #578

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SahibYar
Copy link

@SahibYar SahibYar commented Jan 17, 2025

This PR introduces the following changes:

1. This PR introduces the following changes:

  • Updated occurrences of HTTP methods (e.g., "GET", "POST") with their corresponding constants from the net/http package (e.g., http.MethodGet, http.MethodPost).
  • Ensures consistency, improves maintainability, and reduces the risk of typos.

2. Updated dependencies:

  • Ran go get -u to update the go.mod and go.sum files to their latest versions.

Why these changes?

  • Using constants improves code readability and reduces the risk of errors from hardcoded values.
  • Updating dependencies ensures the project uses the latest features, bug fixes, and security patches.

Testing:

  • executed make all and received following final output
?       github.com/fastly/go-fastly/v9/fastly/products  [no test files]
ok      github.com/fastly/go-fastly/v9/fastly   (cached)
ok      github.com/fastly/go-fastly/v9/fastly/image_optimizer_default_settings  (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/bot_management   (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/brotli_compression       (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/ddos_protection  (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/domain_inspector (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/fanout   (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/image_optimizer  (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/log_explorer_insights    (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/ngwaf    (cached)
ok      github.com/fastly/go-fastly/v9/fastly/products/origin_inspector (cached)
?       github.com/fastly/go-fastly/v9/internal/test_utils      [no test files]
ok      github.com/fastly/go-fastly/v9/fastly/products/websockets       (cached)
ok      github.com/fastly/go-fastly/v9/internal/productcore     (cached)
==> Running go vet
==> Running staticcheck
staticcheck 2024.1.1 (0.5.1)
if command -v semgrep &> /dev/null; then semgrep ci --config auto --exclude-rule generic.secrets.security.detected-private-key.detected-private-key ; fi
                  
                  
┌────────────────┐
│ Debugging Info │
└────────────────┘
                  
  SCAN ENVIRONMENT
  versions    - semgrep 1.103.0 on python 3.13.1                       
  environment - running in environment git, triggering event is unknown
                                                                                                                        
  Scanning 1248 files (only git-tracked) with 1057 Code rules:
            
  CODE RULES
                                                                                                                        
  Language      Rules   Files          Origin      Rules                                                                
 ─────────────────────────────        ───────────────────                                                               
  <multilang>      47    1130          Community    1057                                                                
  yaml             31     974                                                                                           
  go               83     137                                                                                           
  bash              4       5                                                                                           
                                                                                                                        
                    
  SUPPLY CHAIN RULES
                  
  No rules to run.
                  
          
  PROGRESS
   
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00                                                                                                                        
                
                
┌──────────────┐
│ Scan Summary │
└──────────────┘
Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.

@kpfleming
Copy link
Contributor

Thank you for the PR! While most of these changes are welcome, there are too many changes (of unrelated types) included in the PR. Please open PRs which focus on a specific type of change (replacement of constants, updating dependencies, correcting/improving comments, etc.).

Also, the go.mod is pinned to 1.20 for a reason; we do not want to require users of this module to use newer versions of Go at this time, so go mod tidy and similar commands must be run using Go 1.20 in order to preserve compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants