-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from draganm/scripting
Add Scripting
- Loading branch information
Showing
6 changed files
with
177 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.16.4 as builder | ||
FROM golang:1.17.6 as builder | ||
WORKDIR /app | ||
COPY go.mod . | ||
COPY go.sum . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
module github.com/draganm/manifestor | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require ( | ||
github.com/dop251/goja v0.0.0-20220124171016-cfb079cdc7b4 | ||
github.com/drone/envsubst v1.0.2 | ||
github.com/pkg/errors v0.9.1 | ||
github.com/urfave/cli/v2 v2.3.0 | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b | ||
) | ||
|
||
require ( | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect | ||
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect | ||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect | ||
github.com/russross/blackfriday/v2 v2.0.1 // indirect | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect | ||
golang.org/x/text v0.3.6 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/dop251/goja" | ||
) | ||
|
||
func wrap(name string, f func(interface{}) error) func(interface{}) error { | ||
return func(i interface{}) (err error) { | ||
defer func() { | ||
p := recover() | ||
if p == nil { | ||
return | ||
} | ||
|
||
ex, isException := p.(*goja.Exception) | ||
|
||
if isException { | ||
err = fmt.Errorf("while executing %s():\n%v", name, ex.String()) | ||
} else { | ||
err = fmt.Errorf("while executing %s: %v", name, p) | ||
} | ||
|
||
}() | ||
|
||
return f(i) | ||
} | ||
} |