Skip to content

SK-2520: extract hard coded strings to constants and update linting r…#164

Merged
skyflow-himanshu merged 2 commits intorelease/26.1.5from
himanshu/SK-2520-update-linting-rules-and-fix-hardcoded-values-in-go-v2-sdk
Feb 6, 2026
Merged

SK-2520: extract hard coded strings to constants and update linting r…#164
skyflow-himanshu merged 2 commits intorelease/26.1.5from
himanshu/SK-2520-update-linting-rules-and-fix-hardcoded-values-in-go-v2-sdk

Conversation

@skyflow-himanshu
Copy link
Collaborator

Why:
Following the Node SDK linting audit and refactor, this ticket focuses on applying the same linting standards and best practices across GO SDK v2.
The goal is to ensure consistent use of constants over hardcoded values across GO SDK v2, improving maintainability and readability.

Goal:
Update linting rules to discourage hardcoded literals where constants should be used.
Refactor existing code to replace hardcoded values with well-defined constants.

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

GoSec Findings: No issues found, Good to merge.

@skyflow-himanshu skyflow-himanshu changed the base branch from main to release/26.1.5 February 5, 2026 05:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extracts hardcoded string literals into constants as part of a linting audit to improve code maintainability and readability across the GO SDK v2. The changes introduce new linting rules to enforce the use of constants over hardcoded values and update existing code to reference well-defined constants.

Changes:

  • Added new constants for file extensions, entity types, HTTP headers, JSON keys, JWT claims, and other commonly used string literals
  • Refactored existing code to use constants instead of hardcoded string values
  • Updated linting configuration to enable goconst and add-constant rules to enforce constant usage

Reviewed changes

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

Show a summary per file
File Description
v2/internal/constants/constants.go Added 170+ new constant definitions for file extensions, entity types, HTTP headers, JSON keys, and other string literals
v2/utils/messages/error_logs.go Added three new error message constants for JSON marshalling and file operations
v2/utils/error/message.go Added constant for unmarshal error message and adjusted import alias
v2/utils/error/skyflow_exception.go Replaced hardcoded strings with constants for HTTP status, content types, error keys, and headers
v2/internal/vault/controller/vault_controller.go Replaced hardcoded strings with constants for environment variables and response keys
v2/internal/vault/controller/detect_controller.go Replaced hardcoded strings with constants for file types, extensions, entity types, and file processing
v2/internal/vault/controller/connection_controller.go Replaced hardcoded strings with constants for headers, request types, and content types
v2/internal/validation/validations.go Replaced hardcoded strings with constants for request types, entity types, protocols, and validation context
v2/internal/helpers/helpers.go Replaced hardcoded strings with constants for JWT claims, credential keys, JSON keys, and SDK metadata
v2/.golangci.yml Added goconst linter and add-constant rule to enforce constant usage patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skyflow-himanshu skyflow-himanshu merged commit 17ed090 into release/26.1.5 Feb 6, 2026
4 checks passed
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.

3 participants