Skip to content

Commit 79a7eb8

Browse files
committed
Adding version file, analyzer result format conversions
1 parent 5ee72f2 commit 79a7eb8

File tree

12 files changed

+327
-2
lines changed

12 files changed

+327
-2
lines changed

cmd/troubleshoot/cli/receive.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func receiveSupportBundle(collectorJobNamespace string, collectorJobName string)
2727
}
2828
defer os.RemoveAll(bundlePath)
2929

30+
versionFilename, err := writeVersionFile(bundlePath)
31+
if err != nil {
32+
return err
33+
}
34+
3035
receivedCollectors := []string{}
3136
for {
3237
job, err := troubleshootClient.CollectorJobs(collectorJobNamespace).Get(collectorJobName, metav1.GetOptions{})
@@ -117,7 +122,10 @@ func receiveSupportBundle(collectorJobNamespace string, collectorJobName string)
117122
},
118123
}
119124

120-
paths := make([]string, 0, 0)
125+
// version file should be first in tar archive for quick extraction
126+
paths := []string{
127+
versionFilename,
128+
}
121129
for _, id := range receivedCollectors {
122130
paths = append(paths, filepath.Join(bundlePath, id))
123131
}

cmd/troubleshoot/cli/run_nocrd.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
144144
}
145145
defer os.RemoveAll(bundlePath)
146146

147+
versionFilename, err := writeVersionFile(bundlePath)
148+
if err != nil {
149+
return "", err
150+
}
151+
147152
resyncPeriod := time.Second
148153
ctx := context.Background()
149154
watchList := cache.NewListWatchFromClient(restClient, "pods", "", fields.Everything())
@@ -257,7 +262,10 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
257262
},
258263
}
259264

260-
paths := make([]string, 0, 0)
265+
// version file should be first in tar archive for quick extraction
266+
paths := []string{
267+
versionFilename,
268+
}
261269
for _, collectorDir := range collectorDirs {
262270
paths = append(paths, collectorDir)
263271
}

cmd/troubleshoot/cli/version.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package cli
2+
3+
import (
4+
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
5+
"gopkg.in/yaml.v2"
6+
"io/ioutil"
7+
"path/filepath"
8+
)
9+
10+
func writeVersionFile(path string) (string, error) {
11+
version := troubleshootv1beta1.SupportBundleVersion{
12+
ApiVersion: "troubleshoot.replicated.com/v1beta1",
13+
Kind: "SupportBundle",
14+
LayoutVersion: "0.0.1",
15+
}
16+
b, err := yaml.Marshal(version)
17+
if err != nil {
18+
return "", err
19+
}
20+
21+
filename := filepath.Join(path, "version.yaml")
22+
err = ioutil.WriteFile(filename, b, 0644)
23+
if err != nil {
24+
return "", err
25+
}
26+
27+
return filename, nil
28+
}

config/crds/zz_generated.deepcopy.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,3 +1234,18 @@ func (in *StorageClass) DeepCopy() *StorageClass {
12341234
in.DeepCopyInto(out)
12351235
return out
12361236
}
1237+
1238+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
1239+
func (in *SupportBundleVersion) DeepCopyInto(out *SupportBundleVersion) {
1240+
*out = *in
1241+
}
1242+
1243+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleVersion.
1244+
func (in *SupportBundleVersion) DeepCopy() *SupportBundleVersion {
1245+
if in == nil {
1246+
return nil
1247+
}
1248+
out := new(SupportBundleVersion)
1249+
in.DeepCopyInto(out)
1250+
return out
1251+
}

go.mod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,31 @@ module github.com/replicatedhq/troubleshoot
33
go 1.12
44

55
require (
6+
github.com/Masterminds/goutils v1.1.0 // indirect
7+
github.com/Masterminds/semver v1.4.2 // indirect
8+
github.com/Masterminds/sprig v2.20.0+incompatible // indirect
9+
github.com/andrewchambers/go-jqpipe v0.0.0-20180509223707-2d54cef8cd94 // indirect
610
github.com/blang/semver v3.5.1+incompatible
11+
github.com/docker/distribution v2.7.1+incompatible // indirect
12+
github.com/docker/docker v1.13.1 // indirect
13+
github.com/docker/go-connections v0.4.0 // indirect
14+
github.com/docker/go-units v0.4.0 // indirect
715
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
816
github.com/dsnet/compress v0.0.1 // indirect
917
github.com/gin-gonic/gin v1.4.0
1018
github.com/gizak/termui/v3 v3.1.0
1119
github.com/golang/snappy v0.0.1 // indirect
20+
github.com/google/uuid v1.1.1 // indirect
21+
github.com/hashicorp/go-multierror v1.0.0
22+
github.com/huandu/xstrings v1.2.0 // indirect
1223
github.com/manifoldco/promptui v0.3.2 // indirect
1324
github.com/mholt/archiver v3.1.1+incompatible
1425
github.com/nwaples/rardecode v1.0.0 // indirect
1526
github.com/onsi/gomega v1.5.0
27+
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
1628
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
29+
github.com/pkg/errors v0.8.1
30+
github.com/replicatedcom/support-bundle v0.27.1 // indirect
1731
github.com/sergi/go-diff v1.0.0 // indirect
1832
github.com/spf13/cobra v0.0.3
1933
github.com/spf13/viper v1.4.0

go.sum

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ cloud.google.com/go v0.41.0 h1:NFvqUTDnSNYPX5oReekmB+D+90jrJIcVImxQ3qrBVgM=
77
cloud.google.com/go v0.41.0/go.mod h1:OauMR7DV8fzvZIl2qg6rkaIhD/vmgk4iwEw/h6ercmg=
88
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
99
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
10+
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
11+
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
12+
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
13+
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
14+
github.com/Masterminds/sprig v2.20.0+incompatible h1:dJTKKuUkYW3RMFdQFXPU/s6hg10RgctmTjRcbZ98Ap8=
15+
github.com/Masterminds/sprig v2.20.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
1016
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
1117
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
1218
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
1319
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
1420
github.com/alecthomas/gometalinter v2.0.11+incompatible/go.mod h1:qfIpQGGz3d+NmgyPBqv+LSh50emm1pt72EtcX2vKYQk=
1521
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
1622
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
23+
github.com/andrewchambers/go-jqpipe v0.0.0-20180509223707-2d54cef8cd94 h1:mOmUCSuraMWgFv6Wr3pCkt9UZ2RBsx2XMZoIXg2Oj6w=
24+
github.com/andrewchambers/go-jqpipe v0.0.0-20180509223707-2d54cef8cd94/go.mod h1:8KsRln2ynWOaJwxYOUwfPU/ix+H9oh3aCJ6L0DsHW3Q=
1725
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30 h1:Kn3rqvbUFqSepE2OqVu0Pn1CbDw9IuMlONapol0zuwk=
1826
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30/go.mod h1:4AJxUpXUhv4N+ziTvIcWWXgeorXpxPZOfk9HdEVr96M=
1927
github.com/appscode/jsonpatch v2.0.0+incompatible h1:DEsgcSnA7ui6pICc75uxDpyN8Bx4DLFTS8aRym702nE=
@@ -42,6 +50,14 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
4250
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4351
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
4452
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
53+
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
54+
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
55+
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
56+
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
57+
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
58+
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
59+
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
60+
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
4561
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
4662
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c h1:ZfSZ3P3BedhKGUhzj7BQlPSU4OvT6tfOKe3DVHzOA7s=
4763
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
@@ -70,8 +86,10 @@ github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=
7086
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
7187
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
7288
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
89+
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
7390
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
7491
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
92+
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
7593
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
7694
github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg=
7795
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
@@ -149,6 +167,10 @@ github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:Fecb
149167
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
150168
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
151169
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
170+
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
171+
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
172+
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
173+
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
152174
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47 h1:UnszMmmmm5vLwWzDjTFVIkfhvWF1NdrmChl8L2NUDCw=
153175
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
154176
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
@@ -159,6 +181,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
159181
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
160182
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
161183
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
184+
github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
185+
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
162186
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
163187
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
164188
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
@@ -234,6 +258,8 @@ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGV
234258
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
235259
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
236260
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
261+
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
262+
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
237263
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c h1:MUyE44mTvnI5A0xrxIxaMqoWFzPfQvtE2IWUollMDMs=
238264
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
239265
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 h1:zNBQb37RGLmJybyMcs983HfUfpkw9OTFD9tbBfAViHE=
@@ -282,6 +308,7 @@ github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURm
282308
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
283309
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
284310
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
311+
github.com/replicatedcom/support-bundle v0.27.1/go.mod h1:oOJp4t6vM75MBxkBcsGAuwEWRIhq+7wSI05qU/fajPY=
285312
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
286313
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
287314
github.com/rogpeppe/go-internal v1.2.2 h1:J7U/N7eRtzjhs26d6GqMh2HBuXP8/Z64Densiiieafo=

pkg/analyze/cluster_version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func analyzeClusterVersion(analyzer *troubleshootv1beta1.ClusterVersion, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
14+
// TODO: ++++++++
1415
clusterInfo, err := getCollectedFileContents("cluster-info/cluster_version.json")
1516
if err != nil {
1617
return nil, err
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package v1beta1
2+
3+
type SupportBundleVersion struct {
4+
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
5+
Kind string `json:"kind" yaml:"kind"`
6+
LayoutVersion string `json:"layoutVersion" yaml:"layoutVersion"`
7+
}

pkg/apis/troubleshoot/v1beta1/zz_generated.deepcopy.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,3 +1250,18 @@ func (in *StorageClass) DeepCopy() *StorageClass {
12501250
in.DeepCopyInto(out)
12511251
return out
12521252
}
1253+
1254+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
1255+
func (in *SupportBundleVersion) DeepCopyInto(out *SupportBundleVersion) {
1256+
*out = *in
1257+
}
1258+
1259+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportBundleVersion.
1260+
func (in *SupportBundleVersion) DeepCopy() *SupportBundleVersion {
1261+
if in == nil {
1262+
return nil
1263+
}
1264+
out := new(SupportBundleVersion)
1265+
in.DeepCopyInto(out)
1266+
return out
1267+
}

pkg/convert/errors.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package convert
2+
3+
import (
4+
"github.com/pkg/errors"
5+
)
6+
7+
type FuncError struct {
8+
Name string // Name of function.
9+
Err error // Pre-formatted error.
10+
}
11+
12+
func (e FuncError) Error() string {
13+
return e.Err.Error()
14+
}
15+
16+
// Panic will panic with a recoverable error.
17+
func Panic(name string, err error) error {
18+
panic(Error(name, err))
19+
}
20+
21+
// Error will wrap a template error in an ExecError causing template.Execute to recover.
22+
func Error(name string, err error) error {
23+
return FuncError{
24+
Name: name,
25+
Err: err,
26+
}
27+
}
28+
29+
func IsFuncError(err error) bool {
30+
_, ok := errors.Cause(err).(FuncError)
31+
return ok
32+
}

0 commit comments

Comments
 (0)