Skip to content

Commit 8da0890

Browse files
authored
feat: add a HTTP request collector as atest extension (#85)
* feat: add a HTTP request collector as atest extension * add unit tests for collector * add unit tests * support to release atest-collector via goreleaser --------- Co-authored-by: Rick <[email protected]>
1 parent b0b9bf8 commit 8da0890

22 files changed

+634
-18
lines changed

.github/workflows/build.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- name: Test
1717
run: |
1818
go test ./... -coverprofile coverage.out
19+
make test test-collector
1920
- name: Report
2021
if: github.actor == 'linuxsuren'
2122
env:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
bin/
22
.idea/
33
coverage.out
4+
collector-coverage.out
45
dist/
56
.vscode/launch.json
7+
sample.yaml

.goreleaser.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ before:
77
builds:
88
- env:
99
- CGO_ENABLED=0
10+
id: atest
1011
binary: atest
1112
goos:
1213
- linux
@@ -16,8 +17,31 @@ builds:
1617
- -w
1718
- -s
1819
- -X github.com/linuxsuren/api-testing/pkg/version.version={{.Version}}
20+
- env:
21+
- CGO_ENABLED=0
22+
id: collector
23+
binary: atest-collector
24+
main: ./extensions/collector/main.go
25+
goos:
26+
- linux
27+
- windows
28+
- darwin
29+
ldflags:
30+
- -w
31+
- -s
1932
archives:
2033
- name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
34+
builds:
35+
- atest
36+
format_overrides:
37+
- goos: windows
38+
format: zip
39+
files:
40+
- README.md
41+
- name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
42+
id: collector
43+
builds:
44+
- collector
2145
format_overrides:
2246
- goos: windows
2347
format: zip

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ copy-restart: build
1717
test:
1818
go test ./... -cover -v -coverprofile=coverage.out
1919
go tool cover -func=coverage.out
20+
test-collector:
21+
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
22+
go tool cover -func=collector-coverage.out
2023
grpc:
2124
protoc --go_out=. --go_opt=paths=source_relative \
2225
--go-grpc_out=. --go-grpc_opt=paths=source_relative \

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This is a API testing tool.
1616
* Output reference between TestCase
1717
* Run in server mode, and provide the [gRPC endpoint](pkg/server/server.proto)
1818
* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support
19+
* [HTTP API record](extensions/collector)
1920

2021
## Get started
2122

extensions/collector/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test:
2+
go test ./... -cover -v -coverprofile=coverage.out
3+
go tool cover -func=coverage.out

extensions/collector/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
HTTP API record tool.
2+
3+
## Usage
4+
5+
```shell
6+
atest-collector --filter-path /answer/api/v1
7+
```
8+
9+
It will start a HTTP proxy server, and set the server address to your browser proxy (such as: [SwitchyOmega](https://github.com/FelisCatus/SwitchyOmega)).
10+
11+
`atest-collector` will record all HTTP requests which has prefix `/answer/api/v1`, and
12+
save it to file `sample.yaml` once you close the server.

extensions/collector/cmd/collect.go

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package cmd
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"net/http"
7+
"os"
8+
"os/signal"
9+
"strings"
10+
"syscall"
11+
12+
"github.com/elazarl/goproxy"
13+
"github.com/linuxsuren/api-testing/extensions/collector/pkg"
14+
"github.com/linuxsuren/api-testing/extensions/collector/pkg/filter"
15+
"github.com/spf13/cobra"
16+
)
17+
18+
type option struct {
19+
port int
20+
filterPath string
21+
output string
22+
}
23+
24+
// NewRootCmd creates the root command
25+
func NewRootCmd() (c *cobra.Command) {
26+
opt := &option{}
27+
c = &cobra.Command{
28+
Use: "atest-collector",
29+
Short: "A collector for API testing, it will start a HTTP proxy server",
30+
RunE: opt.runE,
31+
}
32+
flags := c.Flags()
33+
flags.IntVarP(&opt.port, "port", "p", 8080, "The port for the proxy")
34+
flags.StringVarP(&opt.filterPath, "filter-path", "", "", "The path prefix for filtering")
35+
flags.StringVarP(&opt.output, "output", "o", "sample.yaml", "The output file")
36+
37+
_ = cobra.MarkFlagRequired(flags, "filter-path")
38+
return
39+
}
40+
41+
type responseFilter struct {
42+
urlFilter *filter.URLPathFilter
43+
collects *pkg.Collects
44+
}
45+
46+
func (f *responseFilter) filter(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response {
47+
contentType := resp.Header.Get("Content-Type")
48+
if !strings.Contains(contentType, "application/json") {
49+
return resp
50+
}
51+
52+
req := resp.Request
53+
if f.urlFilter.Filter(req.URL) {
54+
f.collects.Add(req.Clone(context.TODO()))
55+
}
56+
return resp
57+
}
58+
59+
func (o *option) runE(cmd *cobra.Command, args []string) (err error) {
60+
urlFilter := &filter.URLPathFilter{PathPrefix: o.filterPath}
61+
collects := pkg.NewCollects()
62+
responseFilter := &responseFilter{urlFilter: urlFilter, collects: collects}
63+
64+
proxy := goproxy.NewProxyHttpServer()
65+
proxy.Verbose = true
66+
proxy.OnResponse().DoFunc(responseFilter.filter)
67+
68+
exporter := pkg.NewSampleExporter()
69+
collects.AddEvent(exporter.Add)
70+
71+
srv := &http.Server{
72+
Addr: fmt.Sprintf(":%d", o.port),
73+
Handler: proxy,
74+
}
75+
76+
sig := make(chan os.Signal, 1)
77+
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
78+
go func() {
79+
<-sig
80+
collects.Stop()
81+
_ = srv.Shutdown(context.Background())
82+
}()
83+
84+
cmd.Println("Starting the proxy server with port", o.port)
85+
_ = srv.ListenAndServe()
86+
var data string
87+
if data, err = exporter.Export(); err == nil {
88+
err = os.WriteFile(o.output, []byte(data), 0644)
89+
}
90+
return
91+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"net/http"
5+
"net/url"
6+
"testing"
7+
8+
"github.com/linuxsuren/api-testing/extensions/collector/pkg"
9+
"github.com/linuxsuren/api-testing/extensions/collector/pkg/filter"
10+
"github.com/stretchr/testify/assert"
11+
)
12+
13+
func TestNewRootCmd(t *testing.T) {
14+
c := NewRootCmd()
15+
assert.NotNil(t, c)
16+
assert.Equal(t, "atest-collector", c.Use)
17+
}
18+
19+
func TestResponseFilter(t *testing.T) {
20+
resp := &http.Response{
21+
Header: http.Header{
22+
"Content-Type": []string{"application/json; charset=utf-8"},
23+
},
24+
Request: &http.Request{
25+
URL: &url.URL{},
26+
},
27+
}
28+
emptyResp := &http.Response{}
29+
30+
filter := &responseFilter{
31+
urlFilter: &filter.URLPathFilter{},
32+
collects: pkg.NewCollects(),
33+
}
34+
filter.filter(emptyResp, nil)
35+
filter.filter(resp, nil)
36+
}

extensions/collector/go.mod

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module github.com/linuxsuren/api-testing/extensions/collector
2+
3+
go 1.19
4+
5+
require (
6+
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819
7+
github.com/linuxsuren/api-testing v0.0.11
8+
github.com/spf13/cobra v1.7.0
9+
github.com/stretchr/testify v1.8.4
10+
gopkg.in/yaml.v2 v2.4.0
11+
)
12+
13+
require (
14+
github.com/Masterminds/goutils v1.1.1 // indirect
15+
github.com/Masterminds/semver/v3 v3.2.0 // indirect
16+
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
17+
github.com/davecgh/go-spew v1.1.1 // indirect
18+
github.com/ghodss/yaml v1.0.0 // indirect
19+
github.com/google/uuid v1.3.0 // indirect
20+
github.com/huandu/xstrings v1.3.3 // indirect
21+
github.com/imdario/mergo v0.3.11 // indirect
22+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
23+
github.com/kr/pretty v0.1.0 // indirect
24+
github.com/mitchellh/copystructure v1.0.0 // indirect
25+
github.com/mitchellh/reflectwalk v1.0.0 // indirect
26+
github.com/pmezard/go-difflib v1.0.0 // indirect
27+
github.com/shopspring/decimal v1.2.0 // indirect
28+
github.com/spf13/cast v1.3.1 // indirect
29+
github.com/spf13/pflag v1.0.5 // indirect
30+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
31+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
32+
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
33+
golang.org/x/crypto v0.3.0 // indirect
34+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
35+
gopkg.in/yaml.v3 v3.0.1 // indirect
36+
)
37+
38+
replace github.com/linuxsuren/api-testing => ../../.

extensions/collector/go.sum

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
2+
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
3+
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
4+
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
5+
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
6+
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
7+
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
8+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
10+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
11+
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0=
12+
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
13+
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM=
14+
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
15+
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
16+
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
17+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
18+
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
19+
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
20+
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
21+
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
22+
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
23+
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
24+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
25+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
26+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
27+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
28+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
29+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
30+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
31+
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
32+
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
33+
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
34+
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
35+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
36+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
37+
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
38+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
39+
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
40+
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
41+
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
42+
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
43+
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
44+
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
45+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
46+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
47+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
48+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
49+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
50+
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
51+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
52+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
53+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
54+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
55+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
56+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
57+
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
58+
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
59+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
60+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
61+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
62+
golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A=
63+
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
64+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
65+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
66+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
67+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
68+
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
69+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
70+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
71+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
72+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
73+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
74+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
75+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
76+
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
77+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
78+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
79+
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
80+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
81+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
82+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
83+
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
84+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
85+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
86+
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
87+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
88+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
89+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
90+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
91+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
92+
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
93+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
94+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
95+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
96+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

extensions/collector/main.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
"os"
5+
6+
"github.com/linuxsuren/api-testing/extensions/collector/cmd"
7+
)
8+
9+
func main() {
10+
if err := cmd.NewRootCmd().Execute(); err != nil {
11+
os.Exit(1)
12+
}
13+
}

0 commit comments

Comments
 (0)