Skip to content

Commit

Permalink
Use native errors
Browse files Browse the repository at this point in the history
  • Loading branch information
msanterre committed Feb 27, 2024
1 parent 7c14a35 commit 43d4f61
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -136,7 +137,7 @@ func (w *Walker) walk(inputPath, outputPath string, depth, maxDepth int, visited
if hashGenerated != hash || emptyManifest {
log.Printf("No match detected. Render: %s\n", crd.ObjectMeta.Name)
if err := w.Render(crd, path); err != nil {
if strings.Contains(err.Error(), "not supported") {
if errors.Is(err, errors.ErrUnsupported) {

Check failure on line 140 in main.go

View workflow job for this annotation

GitHub Actions / build

undefined: errors.ErrUnsupported

Check failure on line 140 in main.go

View workflow job for this annotation

GitHub Actions / go_test

undefined: errors.ErrUnsupported
continue
}
return err
Expand Down Expand Up @@ -166,7 +167,7 @@ func (w *Walker) Render(application *v1alpha1.Application, output string) error
render = w.HelmTemplate
case application.Spec.Source.Kustomize != nil:
log.Println("WARNING: kustomize not supported")
return fmt.Errorf("kustomize not supported")
return errors.ErrUnsupported

Check failure on line 170 in main.go

View workflow job for this annotation

GitHub Actions / build

undefined: errors.ErrUnsupported

Check failure on line 170 in main.go

View workflow job for this annotation

GitHub Actions / go_test

undefined: errors.ErrUnsupported
default:
render = w.CopySource
}
Expand Down Expand Up @@ -224,7 +225,7 @@ func main() {
// Runs the command in the specified directory
err := os.Chdir(*workdir)
if err != nil {
log.Fatal(err)
log.Fatal("Could not set workdir: ", err)
}

start := time.Now()
Expand Down

0 comments on commit 43d4f61

Please sign in to comment.