Skip to content

Commit 5b1664f

Browse files
committed
fix: Resolve staticcheck linter warnings
Fixed three linter issues identified by staticcheck: 1. Replaced deprecated strings.Title with custom Title function - strings.Title was deprecated in Go 1.18 - Used existing Title() helper function instead 2. Removed unused otherDecorators variable in WGSL generator - The append result was never used - Added comment noting other decorators aren't currently supported 3. Removed unnecessary fmt.Sprintf for static string - Changed fmt.Sprintf("// ...") to direct string literal - Improves code clarity and performance All tests passing, linter clean.
1 parent cd07c3c commit 5b1664f

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

pkg/codegen/gpu_go_generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (g *GPUGoGenerator) generateGPUStruct(gpuStruct *guixast.GPUStructDecl) *as
111111
astType := g.parseTypeString(goType)
112112

113113
fields = append(fields, &ast.Field{
114-
Names: []*ast.Ident{ast.NewIdent(strings.Title(field.Name))},
114+
Names: []*ast.Ident{ast.NewIdent(Title(field.Name))},
115115
Type: astType,
116116
})
117117
}

pkg/codegen/wgsl_generator.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,14 @@ func (g *WGSLGenerator) generateBinding(binding *guixast.GPUBindingDecl) {
170170
func (g *WGSLGenerator) generateFunction(fn *guixast.GPUFuncDecl) {
171171
// Collect entry point decorators (@vertex, @fragment, @compute)
172172
var entryDecorators []string
173-
var otherDecorators []string
174173

175174
for _, decorator := range fn.Decorators {
176175
// Strip @ prefix for comparison
177176
name := strings.TrimPrefix(decorator.Name, "@")
178177
if name == "vertex" || name == "fragment" || name == "compute" {
179178
entryDecorators = append(entryDecorators, g.formatDecorator(decorator))
180-
} else {
181-
otherDecorators = append(otherDecorators, g.formatDecorator(decorator))
182179
}
180+
// Other decorators are currently not supported for functions
183181
}
184182

185183
// Write entry point decorators
@@ -412,7 +410,7 @@ func (g *WGSLGenerator) generateFor(forLoop *guixast.ForLoop) {
412410
if forLoop.Range != nil {
413411
// Range-based for loop not directly supported in WGSL
414412
// Convert to C-style for loop
415-
g.writeln(fmt.Sprintf("// Range-based for loop not directly supported"))
413+
g.writeln("// Range-based for loop not directly supported")
416414
g.writeln(fmt.Sprintf("// for %s in %s", forLoop.Val, g.generateExpression(forLoop.Range)))
417415
} else {
418416
// C-style for loop

0 commit comments

Comments
 (0)