Skip to content

Commit 2d859ee

Browse files
committed
fix: remove duplicate functions and fix compilation errors
- Remove duplicate setRenderStatus function in executor.go - Remove duplicate stepName function definition - Fix code formatting in types.go - All packages now pass go vet checks Fixes compilation errors detected by Copilot AI review. Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com>
1 parent c5bd1d6 commit 2d859ee

2 files changed

Lines changed: 3 additions & 42 deletions

File tree

internal/util/render/executor.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -321,45 +321,6 @@ func stepName(s kptfilev1.PipelineStepResult) string {
321321
return s.ExecPath
322322
}
323323

324-
}
325-
326-
func stepName(s kptfilev1.PipelineStepResult) string {
327-
if s.Name != "" {
328-
return s.Name
329-
}
330-
if s.Image != "" {
331-
return s.Image
332-
}
333-
return s.ExecPath
334-
}
335-
336-
// setRenderStatus reads the Kptfile at pkgPath, sets the Rendered condition and RenderStatus, and writes it back.
337-
func setRenderStatus(fs filesys.FileSystem, pkgPath string, condition kptfilev1.Condition, renderStatus *kptfilev1.RenderStatus) {
338-
fsOrDisk := filesys.FileSystemOrOnDisk{FileSystem: fs}
339-
kf, err := kptfileutil.ReadKptfile(fsOrDisk, pkgPath)
340-
if err != nil {
341-
klog.V(3).Infof("failed to read Kptfile for render status update at %s: %v", pkgPath, err)
342-
return
343-
}
344-
if kf.Status == nil {
345-
kf.Status = &kptfilev1.Status{}
346-
}
347-
// Replace any existing Rendered condition
348-
kf.Status.Conditions = slices.DeleteFunc(kf.Status.Conditions, func(c kptfilev1.Condition) bool {
349-
return c.Type == kptfilev1.ConditionTypeRendered
350-
})
351-
kf.Status.Conditions = append(kf.Status.Conditions, condition)
352-
353-
// Update render status if provided
354-
if renderStatus != nil {
355-
kf.Status.RenderStatus = renderStatus
356-
}
357-
358-
if err := kptfileutil.WriteKptfileToFS(fs, pkgPath, kf); err != nil {
359-
klog.V(3).Infof("failed to write render status to Kptfile at %s: %v", pkgPath, err)
360-
}
361-
}
362-
363324
// recordPipelineStepResult records the result of a pipeline step execution
364325
func recordPipelineStepResult(hctx *hydrationContext, stepResult kptfilev1.PipelineStepResult, isValidator bool) {
365326
if hctx.renderStatus == nil {

pkg/api/kptfile/v1/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ type PipelineStepResult struct {
440440

441441
// ResultItem mirrors framework.Result with only the fields needed for Kptfile status.
442442
type ResultItem struct {
443-
Resource string `yaml:"resource,omitempty" json:"resource,omitempty"`
444-
Message string `yaml:"message,omitempty" json:"message,omitempty"`
445-
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
443+
Resource string `yaml:"resource,omitempty" json:"resource,omitempty"`
444+
Message string `yaml:"message,omitempty" json:"message,omitempty"`
445+
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
446446
ResourceRef *ResourceRef `yaml:"resourceRef,omitempty" json:"resourceRef,omitempty"`
447447
Field *FieldRef `yaml:"field,omitempty" json:"field,omitempty"`
448448
File *FileRef `yaml:"file,omitempty" json:"file,omitempty"`

0 commit comments

Comments
 (0)