Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd4c268

Browse files
author
Adrian Cole
committedMar 24, 2021
Changes from statik to go:embed for examples serving
There's currently a glitch because go.mod isn't allowed in the go:embed path. Fixes #126 See golang/go#41191 (comment)
1 parent 5d8ef0e commit cd4c268

File tree

22 files changed

+51
-143
lines changed

22 files changed

+51
-143
lines changed
 

‎.circleci/config.yml

-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
GOMAXPROCS: "3"
3333
steps:
3434
- checkout
35-
- run: make init
3635
- run: ./ci/install-lint
3736
- run: ./ci/lint
3837

@@ -41,7 +40,6 @@ jobs:
4140
resource_class: medium+
4241
steps:
4342
- checkout
44-
- run: make init
4543
- run: ./ci/install-envoy
4644
- run: ./ci/test
4745
- run:

‎.github/workflows/commit.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ jobs:
2121
- name: "Install Go"
2222
uses: actions/setup-go@v2
2323
with:
24-
go-version: '1.13.3'
25-
26-
- name: "Init on first use"
27-
run: make init
24+
go-version: '1.16.2'
2825

2926
- name: "Build `getenvoy` and `e2e` binaries"
3027
run: make bin

‎.github/workflows/release.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: "Set up Go"
2222
uses: actions/setup-go@v2
2323
with:
24-
go-version: '1.13.3'
24+
go-version: '1.16.2'
2525

2626
- name: "Login into DockerHub"
2727
uses: azure/docker-login@v1
@@ -75,7 +75,7 @@ jobs:
7575
- name: "Install Go"
7676
uses: actions/setup-go@v2
7777
with:
78-
go-version: '1.13.3'
78+
go-version: '1.16.2'
7979

8080
- name: "Build `e2e` binaries"
8181
run: make build/bin/linux/amd64/e2e build/bin/darwin/amd64/e2e

‎.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ vendor
22
dist
33
/getenvoy
44
/build/
5-
6-
# code generated by `github.com/rakyll/statik`
7-
statik.go
5+
.idea

‎.goreleaser.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
project_name: getenvoy
1616
env:
1717
- GO111MODULE=on
18-
before:
19-
hooks:
20-
- make init
2118
builds:
2219
- binary: getenvoy
2320
ldflags: "-s -w -X github.com/tetratelabs/getenvoy/pkg/version.version={{.Version}}"

‎Makefile

+4-11
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ GETENVOY_OUT_PATH = $(BIN_DIR)/$(1)/$(2)/getenvoy
5757

5858
define GEN_GETENVOY_BUILD_TARGET
5959
.PHONY: $(call GETENVOY_OUT_PATH,$(1),$(2))
60-
$(call GETENVOY_OUT_PATH,$(1),$(2)): generate
60+
$(call GETENVOY_OUT_PATH,$(1),$(2)):
6161
CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build $(GO_LD_FLAGS) -o $(call GETENVOY_OUT_PATH,$(1),$(2)) ./cmd/getenvoy/main.go
6262
endef
6363
$(foreach os,$(GOOSES),$(foreach arch,$(GOARCHS),$(eval $(call GEN_GETENVOY_BUILD_TARGET,$(os),$(arch)))))
@@ -71,17 +71,10 @@ $(call E2E_OUT_PATH,$(1),$(2)):
7171
endef
7272
$(foreach os,$(GOOSES),$(foreach arch,$(GOARCHS),$(eval $(call GEN_E2E_BUILD_TARGET,$(os),$(arch)))))
7373

74-
.PHONY: init
75-
init: generate
76-
7774
.PHONY: deps
7875
deps:
7976
go mod download
8077

81-
.PHONY: generate
82-
generate: deps
83-
go generate ./pkg/...
84-
8578
.PHONY: build
8679
build: $(call GETENVOY_OUT_PATH,$(GOOS),$(GOARCH))
8780

@@ -94,12 +87,12 @@ release.dryrun:
9487
goreleaser release --skip-publish --snapshot --rm-dist
9588

9689
.PHONY: test
97-
test: generate
90+
test:
9891
docker-compose up -d
9992
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)
10093

10194
.PHONY: test.ci
102-
test.ci: generate
95+
test.ci:
10396
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)
10497

10598
.PHONY: e2e
@@ -123,7 +116,7 @@ endef
123116
$(foreach os,$(GOOSES),$(foreach arch,$(GOARCHS),$(eval $(call GEN_BIN_GOOS_GOARCH_TARGET,$(os),$(arch)))))
124117

125118
.PHONY: coverage
126-
coverage: generate
119+
coverage:
127120
mkdir -p "$(shell dirname "$(COVERAGE_PROFILE)")"
128121
go test $(GO_COVERAGE_OPTS) $(GO_COVERAGE_EXTRA_OPTS) -coverprofile="$(COVERAGE_PROFILE)" $(COVERAGE_PKG_LIST)
129122
go tool cover -html="$(COVERAGE_PROFILE)" -o "$(COVERAGE_REPORT)"

‎data/extension/init/templates.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package init
2+
// ^^ last path in the directory relative from the project root data/extension/init
3+
4+
import (
5+
"embed"
6+
"io/fs"
7+
)
8+
9+
// templatesFs includes only the relative path of "templates".
10+
//
11+
// Assets must be in this directory because go:embed doesn't support navigation outside (ex. ../)
12+
// See https://pkg.go.dev/embed#hdr-Directives
13+
//go:embed templates/*
14+
var templatesFs embed.FS
15+
16+
// GetTemplates returns the templates directory as a filesystem
17+
func GetTemplates() fs.FS {
18+
fs, err := fs.Sub(templatesFs, "templates")
19+
if err != nil {
20+
panic(err) // unexpected or a typo
21+
}
22+
return fs
23+
}

‎data/extension/init/templates/tinygo/envoy.access_loggers/default/go.mod

-8
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.access_loggers/default/go.sum

-13
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.access_loggers/default/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package init
22

33
import (
44
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"

‎data/extension/init/templates/tinygo/envoy.filters.http/default/go.mod

-8
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.filters.http/default/go.sum

-13
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.filters.http/default/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package init
22

33
import (
44
"bufio"

‎data/extension/init/templates/tinygo/envoy.filters.http/default/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package init
22

33
import (
44
"testing"

‎data/extension/init/templates/tinygo/envoy.filters.network/default/go.mod

-8
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.filters.network/default/go.sum

-13
This file was deleted.

‎data/extension/init/templates/tinygo/envoy.filters.network/default/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package init
22

33
import (
44
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"

‎data/extension/init/templates/tinygo/envoy.filters.network/default/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package init
22

33
import (
44
"testing"

‎go.mod

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module github.com/tetratelabs/getenvoy
22

3-
go 1.13
3+
// This project uses go:embed, so requires minimally go 1.16
4+
go 1.16
45

56
require (
67
bitbucket.org/creachadair/shell v0.0.6
@@ -16,7 +17,7 @@ require (
1617
github.com/go-ole/go-ole v1.2.4 // indirect
1718
github.com/golang/protobuf v1.3.5
1819
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
19-
github.com/manifoldco/promptui v0.0.0-00010101000000-000000000000
20+
github.com/manifoldco/promptui v0.8.0
2021
github.com/mattn/go-isatty v0.0.12
2122
github.com/mattn/go-shellwords v1.0.10
2223
github.com/mholt/archiver v3.1.1+incompatible
@@ -27,7 +28,6 @@ require (
2728
github.com/opencontainers/selinux v1.8.0 // indirect
2829
github.com/otiai10/copy v1.2.0
2930
github.com/pkg/errors v0.9.1
30-
github.com/rakyll/statik v0.0.0-00010101000000-000000000000
3131
github.com/schollz/progressbar/v2 v2.13.2
3232
github.com/shirou/gopsutil v0.0.0-20190731134726-d80c43f9c984
3333
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
@@ -47,7 +47,3 @@ replace github.com/Azure/go-autorest/autorest => github.com/Azure/go-autorest/au
4747
replace github.com/docker/docker => github.com/docker/docker v17.12.1-ce+incompatible
4848

4949
replace github.com/hashicorp/consul => github.com/hashicorp/consul v1.3.1
50-
51-
replace github.com/manifoldco/promptui => github.com/yskopets/promptui v0.7.1-0.20200429230902-361491009c11
52-
53-
replace github.com/rakyll/statik => github.com/yskopets/statik v0.1.8-0.20200501213002-c2d8dcc79889

‎go.sum

+2-17
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ fortio.org/fortio v1.3.1/go.mod h1:Go0fRqoPJ1xy5JOWcS23jyF58byVZxFyEePYsGmCR0k=
2626
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
2727
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
2828
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
29-
github.com/Azure/go-autorest v10.8.1+incompatible h1:u0jVQf+a6k6x8A+sT60l6EY9XZu+kHdnZVPAYqpVRo0=
3029
github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
3130
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
3231
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
@@ -51,7 +50,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
5150
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
5251
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
5352
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
54-
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
5553
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
5654
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
5755
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
@@ -106,11 +104,9 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
106104
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
107105
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
108106
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
109-
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
110107
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
111108
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
112109
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
113-
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
114110
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
115111
github.com/bshuster-repo/logrus-logstash-hook v0.4.1 h1:pgAtgj+A31JBVtEHu2uHuEx0n+2ukqUJnS2vVe5pQNA=
116112
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
@@ -140,7 +136,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
140136
github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533 h1:8wZizuKuZVu5COB7EsBYxBQz8nRcXXn5d4Gt91eJLvU=
141137
github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
142138
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
143-
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
144139
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
145140
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f h1:tSNMc+rJDfmYntojat8lljbt1mgKNpTxUZJsSzJ9Y1s=
146141
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
@@ -174,7 +169,6 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc
174169
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
175170
github.com/cyphar/filepath-securejoin v0.2.2 h1:jCwT2GTP+PY5nBz3c/YL5PAIbusElVrPujOBSCj8xRg=
176171
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
177-
github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt9U=
178172
github.com/d4l3k/messagediff v1.2.1/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
179173
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
180174
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -413,7 +407,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
413407
github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
414408
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
415409
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
416-
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20171214222146-0e7658f8ee99 h1:bTRV2bQrg85E7ZeeyQfHX3GyfidLrNzVoyq7epx0bTw=
417410
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20171214222146-0e7658f8ee99/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
418411
github.com/hashicorp/consul v1.3.1 h1:bY7/Uo29Uq7+mHce4wgSHtAJSbeRl+4F7M+OHTuEeXI=
419412
github.com/hashicorp/consul v1.3.1/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI=
@@ -521,6 +514,8 @@ github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN
521514
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
522515
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
523516
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
517+
github.com/manifoldco/promptui v0.8.0 h1:R95mMF+McvXZQ7j1g8ucVZE1gLP3Sv6j9vlF9kyRqQo=
518+
github.com/manifoldco/promptui v0.8.0/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ=
524519
github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
525520
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
526521
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
@@ -551,7 +546,6 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb
551546
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
552547
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
553548
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
554-
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f h1:2+myh5ml7lgEU/51gbeLHfKGNfgEQQIWrlbdaOsidbQ=
555549
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
556550
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
557551
github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE=
@@ -612,14 +606,12 @@ github.com/opencontainers/selinux v1.8.0 h1:+77ba4ar4jsCbL1GLbFL8fFM57w6suPfSS9P
612606
github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
613607
github.com/openshift/api v3.9.1-0.20191008181517-e4fd21196097+incompatible h1:CIa+Zv6vIPhJl5OHmKxVpnekHC54YYe49L9GLr7IxGI=
614608
github.com/openshift/api v3.9.1-0.20191008181517-e4fd21196097+incompatible/go.mod h1:dh9o4Fs58gpFXGSYfnVxGR9PnV53I8TW84pQaJDdGiY=
615-
github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg=
616609
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
617610
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
618611
github.com/openzipkin/zipkin-go v0.1.7/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
619612
github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=
620613
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
621614
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
622-
github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
623615
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
624616
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
625617
github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc=
@@ -747,7 +739,6 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH
747739
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
748740
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
749741
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
750-
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
751742
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
752743
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
753744
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -763,9 +754,7 @@ github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW
763754
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
764755
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
765756
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
766-
github.com/uber/jaeger-client-go v0.0.0-20190228190846-ecf2d03a9e80 h1:nWzkj/LnVGFeaeXAAXq7AyH4BQP3678Lqj3y2fIaieg=
767757
github.com/uber/jaeger-client-go v0.0.0-20190228190846-ecf2d03a9e80/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
768-
github.com/uber/jaeger-lib v2.0.0+incompatible h1:iMSCV0rmXEogjNWPh2D0xk9YVKvrtGoHJNe9ebLu/pw=
769758
github.com/uber/jaeger-lib v2.0.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
770759
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
771760
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
@@ -788,10 +777,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
788777
github.com/yashtewari/glob-intersection v0.0.0-20180206001645-7af743e8ec84/go.mod h1:HptNXiXVDcJjXe9SqMd0v2FsL9f8dz4GnXgltU6q/co=
789778
github.com/yl2chen/cidranger v0.0.0-20180214081945-928b519e5268 h1:lkoOjizoHqOcEFsvYGE5c8Ykdijjnd0R3r1yDYHzLno=
790779
github.com/yl2chen/cidranger v0.0.0-20180214081945-928b519e5268/go.mod h1:mq0zhomp/G6rRTb0dvHWXRHr/2+Qgeq5hMXfJ670+i4=
791-
github.com/yskopets/promptui v0.7.1-0.20200429230902-361491009c11 h1:MlzMpHq1fRfH1RYzfQ7Ch7JjdGnBq/m29jJtPOExWuw=
792-
github.com/yskopets/promptui v0.7.1-0.20200429230902-361491009c11/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ=
793-
github.com/yskopets/statik v0.1.8-0.20200501213002-c2d8dcc79889 h1:f62aKW+gryXYYtNut+3b6i5n1ioXCXJWpDgA11l6Pak=
794-
github.com/yskopets/statik v0.1.8-0.20200501213002-c2d8dcc79889/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
795780
github.com/yuin/gopher-lua v0.0.0-20180316054350-84ea3a3c79b3/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
796781
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 h1:+lm10QQTNSBd8DVTNGHx7o/IKu9HYDvLMffDhbyLccI=
797782
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=

‎pkg/extension/example/init/registry/default.go

+5-13
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,19 @@
1414

1515
package registry
1616

17-
//go:generate go run github.com/rakyll/statik -p=templates -m -ns=example/init/templates -src=../../../../../data/example/init/templates -a -include=* -f
18-
1917
import (
18+
templateAssets "github.com/tetratelabs/getenvoy/data/extension/init"
19+
"net/http"
2020
"path"
2121

22-
"github.com/rakyll/statik/fs"
23-
24-
// force execution of auto generated code
25-
_ "github.com/tetratelabs/getenvoy/pkg/extension/example/init/registry/templates"
26-
2722
"github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension"
2823
)
2924

25+
var templatesFs = templateAssets.GetTemplates()
26+
3027
func newDefaultRegistry() registry {
31-
fileSystem, err := fs.NewWithNamespace("example/init/templates")
32-
if err != nil {
33-
// must be caught by unit tests
34-
panic(err)
35-
}
3628
return &fsRegistry{
37-
fs: fileSystem,
29+
fs: http.FS(templatesFs),
3830
namingScheme: func(category extension.Category, example string) string {
3931
return "/" + path.Join(category.String(), example)
4032
},

‎pkg/extension/init/source.go

+5-13
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@
1414

1515
package init
1616

17-
//go:generate go run github.com/rakyll/statik -p=templates -m -ns=extension/init/templates -src=../../../data/extension/init/templates -a -include=* -f
18-
1917
import (
18+
templateAssets "github.com/tetratelabs/getenvoy/data/extension/init"
19+
"net/http"
2020
"path"
2121
"sync"
2222

23-
"github.com/rakyll/statik/fs"
24-
2523
"github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension"
26-
27-
// force execution of auto generated code
28-
_ "github.com/tetratelabs/getenvoy/pkg/extension/init/templates"
2924
)
3025

3126
var (
@@ -34,17 +29,14 @@ var (
3429
templatesOnce sync.Once
3530
)
3631

32+
var templatesFs = templateAssets.GetTemplates()
33+
3734
// getTemplateSource returns a source of extension templates.
3835
func getTemplateSource() templateSource {
3936
// do lazy init to avoid zip decompression unless absolutely necessary
4037
templatesOnce.Do(func() {
41-
fileSystem, err := fs.NewWithNamespace("extension/init/templates")
42-
if err != nil {
43-
// must be caught by unit tests
44-
panic(err)
45-
}
4638
templates = &fsTemplateSource{
47-
fs: fileSystem,
39+
fs: http.FS(templatesFs),
4840
namingScheme: func(language extension.Language, category extension.Category, template string) string {
4941
return "/" + path.Join(language.String(), category.String(), template)
5042
},

0 commit comments

Comments
 (0)
Please sign in to comment.