Skip to content

feat(golang): Go AST helper functions and parser scaffold (PR-02)#521

Merged
shivasurya merged 1 commit into
mainfrom
shiva/golang-pr02-helpers-scaffold
Feb 15, 2026
Merged

feat(golang): Go AST helper functions and parser scaffold (PR-02)#521
shivasurya merged 1 commit into
mainfrom
shiva/golang-pr02-helpers-scaffold

Conversation

@shivasurya
Copy link
Copy Markdown
Owner

Summary

  • Create graph/golang/ package with 8 shared utility functions
  • Add GoParams struct for parameter extraction across all declaration parsers
  • Add setGoSourceLocation helper in parser_golang.go for consistent byte-range tracking
  • Add empty parser_golang.go dispatcher shell

Test plan

  • ExtractParameters handles grouped params: a, b int correctly
  • ExtractParameters handles variadic params: args ...string correctly
  • ExtractParameters handles unnamed params: func(int, string) correctly
  • ExtractReturnType handles single, multi, named, and empty returns
  • ExtractReceiverType strips pointer from *Server"Server"
  • ExtractReceiverType gracefully returns "" for generic receivers (*Stack[T])
  • ExtractStructFields extracts named fields + embedded types
  • ExtractInterfaceMethods extracts methods + embedded interfaces (type_elem)
  • DetermineVisibility distinguishes exported vs unexported names
  • IsInitFunction("init") → true; IsInitFunction("main") → false
  • IsGoKeyword covers all 25 keywords + predeclared types + 18 builtins + any/comparable
  • setGoSourceLocation sets File/StartByte/EndByte on nodes
  • go build ./... compiles without errors
  • go test ./graph/golang/... passes all tests (94.1% coverage; remaining 5.9% is defensive guards unreachable by tree-sitter)
  • go vet ./... reports zero findings
  • No regressions in existing Python/Java test suites

🤖 Generated with Claude Code

@shivasurya shivasurya added the enhancement New feature or request label Feb 14, 2026
@shivasurya shivasurya self-assigned this Feb 14, 2026
@safedep
Copy link
Copy Markdown

safedep Bot commented Feb 14, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 87.17949% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.82%. Comparing base (46c3910) to head (b072f16).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sast-engine/graph/golang/helpers.go 91.07% 5 Missing and 5 partials ⚠️
sast-engine/graph/parser_golang.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #521      +/-   ##
==========================================
+ Coverage   82.78%   82.82%   +0.03%     
==========================================
  Files         122      124       +2     
  Lines       14345    14462     +117     
==========================================
+ Hits        11876    11978     +102     
- Misses       2021     2031      +10     
- Partials      448      453       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shivasurya shivasurya changed the title feat: Go AST helper functions and parser scaffold feat(golang): Go AST helper functions and parser scaffold (PR-02) Feb 14, 2026
Copy link
Copy Markdown
Owner Author

shivasurya commented Feb 15, 2026

Merge activity

  • Feb 15, 4:00 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 15, 4:01 AM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 15, 4:02 AM UTC: @shivasurya merged this pull request with Graphite.

@shivasurya shivasurya changed the base branch from shiva/golang-pr01-file-detection to graphite-base/521 February 15, 2026 04:00
@shivasurya shivasurya changed the base branch from graphite-base/521 to main February 15, 2026 04:00
Create graph/golang/ package with 8 shared utility functions and GoParams
struct for parameter extraction across all declaration parsers (PR-03
through PR-06).

Helpers:
- ExtractParameters: handles grouped params (a, b int), variadic, unnamed
- ExtractReturnType: single, multi, named returns
- ExtractReceiverType: strips pointer (*Server → "Server")
- ExtractStructFields: named fields + embedded types
- ExtractInterfaceMethods: method specs + embedded interfaces
- DetermineVisibility: Go capitalization convention (public/private)
- IsInitFunction: detect init() special semantics
- IsGoKeyword: 25 keywords + predeclared identifiers/types + 18 builtins

Also adds parser_golang.go empty dispatcher shell with setGoSourceLocation
helper for consistent byte-range tracking on every node.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shivasurya shivasurya force-pushed the shiva/golang-pr02-helpers-scaffold branch from 2ac41d1 to b072f16 Compare February 15, 2026 04:01
@github-actions
Copy link
Copy Markdown

Code Pathfinder Security Scan

Pass Critical High Medium Low Info

No security issues detected.

Metric Value
Files Scanned 3
Rules 38

Powered by Code Pathfinder

@shivasurya shivasurya merged commit c19850d into main Feb 15, 2026
4 of 5 checks passed
@shivasurya shivasurya deleted the shiva/golang-pr02-helpers-scaffold branch February 15, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant