diff --git a/.bingo/.gitignore b/.bingo/.gitignore new file mode 100644 index 0000000..9efccf6 --- /dev/null +++ b/.bingo/.gitignore @@ -0,0 +1,13 @@ + +# Ignore everything +* + +# But not these files: +!.gitignore +!*.mod +!*.sum +!README.md +!Variables.mk +!variables.env + +*tmp.mod diff --git a/.bingo/README.md b/.bingo/README.md new file mode 100644 index 0000000..7a5c2d4 --- /dev/null +++ b/.bingo/README.md @@ -0,0 +1,14 @@ +# Project Development Dependencies. + +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. + +* Run `bingo get` to install all tools having each own module file in this directory. +* Run `bingo get ` to install that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. +* For go: Import `.bingo/variables.go` to for variable names. +* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. + +## Requirements + +* Go 1.14+ diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk new file mode 100644 index 0000000..5943247 --- /dev/null +++ b/.bingo/Variables.mk @@ -0,0 +1,37 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Below generated variables ensure that every time a tool under each variable is invoked, the correct version +# will be used; reinstalling only if needed. +# For example for ginkgo variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(GINKGO) +# @echo "Running ginkgo" +# @$(GINKGO) +# +GINKGO := $(GOBIN)/ginkgo-v1.16.5 +$(GINKGO): $(BINGO_DIR)/ginkgo.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/ginkgo-v1.16.5" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v1.16.5 "github.com/onsi/ginkgo/ginkgo" + +GOVER := $(GOBIN)/gover-v0.0.0-20171022184752-b58185e213c5 +$(GOVER): $(BINGO_DIR)/gover.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/gover-v0.0.0-20171022184752-b58185e213c5" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gover.mod -o=$(GOBIN)/gover-v0.0.0-20171022184752-b58185e213c5 "github.com/modocache/gover" + +GOVERALLS := $(GOBIN)/goveralls-v0.0.12 +$(GOVERALLS): $(BINGO_DIR)/goveralls.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/goveralls-v0.0.12" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goveralls.mod -o=$(GOBIN)/goveralls-v0.0.12 "github.com/mattn/goveralls" + diff --git a/.bingo/ginkgo.mod b/.bingo/ginkgo.mod new file mode 100644 index 0000000..8e521e2 --- /dev/null +++ b/.bingo/ginkgo.mod @@ -0,0 +1,8 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.23.4 + +// git tag accidentally associated with incorrect git commit +retract v1.16.3 + +require github.com/onsi/ginkgo v1.16.5 // ginkgo diff --git a/.bingo/ginkgo.sum b/.bingo/ginkgo.sum new file mode 100644 index 0000000..c5112c1 --- /dev/null +++ b/.bingo/ginkgo.sum @@ -0,0 +1,76 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/.bingo/go.mod b/.bingo/go.mod new file mode 100644 index 0000000..610249a --- /dev/null +++ b/.bingo/go.mod @@ -0,0 +1 @@ +module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. \ No newline at end of file diff --git a/.bingo/gover.mod b/.bingo/gover.mod new file mode 100644 index 0000000..0a376b6 --- /dev/null +++ b/.bingo/gover.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.23.4 + +require github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5 diff --git a/.bingo/gover.sum b/.bingo/gover.sum new file mode 100644 index 0000000..795dbc4 --- /dev/null +++ b/.bingo/gover.sum @@ -0,0 +1,2 @@ +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5 h1:8Q0qkMVC/MmWkpIdlvZgcv2o2jrlF6zqVOh7W5YHdMA= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= diff --git a/.bingo/goveralls.mod b/.bingo/goveralls.mod new file mode 100644 index 0000000..4cb9410 --- /dev/null +++ b/.bingo/goveralls.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.23.4 + +require github.com/mattn/goveralls v0.0.12 diff --git a/.bingo/goveralls.sum b/.bingo/goveralls.sum new file mode 100644 index 0000000..91cdde9 --- /dev/null +++ b/.bingo/goveralls.sum @@ -0,0 +1,40 @@ +github.com/mattn/goveralls v0.0.12 h1:PEEeF0k1SsTjOBQ8FOmrOAoCu4ytuMaWCnWe94zxbCg= +github.com/mattn/goveralls v0.0.12/go.mod h1:44ImGEUfmqH8bBtaMrYKsM65LXfNLWmwaxFGjZwgMSQ= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/.bingo/variables.env b/.bingo/variables.env new file mode 100644 index 0000000..4dad6bc --- /dev/null +++ b/.bingo/variables.env @@ -0,0 +1,16 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. +GOBIN=${GOBIN:=$(go env GOBIN)} + +if [ -z "$GOBIN" ]; then + GOBIN="$(go env GOPATH)/bin" +fi + + +GINKGO="${GOBIN}/ginkgo-v1.16.5" + +GOVER="${GOBIN}/gover-v0.0.0-20171022184752-b58185e213c5" + +GOVERALLS="${GOBIN}/goveralls-v0.0.12" + diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dc1b437..908a15e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -8,28 +8,43 @@ on: - master jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Install dependencies + run: | + go mod download + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + args: -v + skip-cache: false + test: runs-on: ubuntu-latest - strategy: - matrix: - go: [ '1.18', '1.19', '1.20' ] - name: Go ${{ matrix.go }} tests + name: Go tests steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} + go-version: '1.23' + - name: Install dependencies run: | go get -t -d -v ./... - go get github.com/onsi/ginkgo/ginkgo - go install github.com/onsi/ginkgo/ginkgo - go get -u golang.org/x/lint/golint - go get -u github.com/modocache/gover - go install github.com/modocache/gover - go get -u github.com/mattn/goveralls - go install github.com/mattn/goveralls + go install github.com/bwplotka/bingo@v0.9.0 + bingo get -l + - name: Run tests run: | ginkgo -r -cover --randomizeAllSpecs --randomizeSuites --failOnPending --trace --race --progress @@ -37,7 +52,5 @@ jobs: ginkgo -tags=gingonic -r --randomizeSuites --failOnPending --trace --race ginkgo -tags=echo -r --randomizeSuites --failOnPending --trace --race rm examples/examples.coverprofile - bash scripts/fmtpolice gover goveralls -coverprofile=gover.coverprofile -repotoken gY90SprlNRGmSMl7MgybLreYa05wUXJTU - diff --git a/api.go b/api.go index 5d2e381..b82a2e3 100644 --- a/api.go +++ b/api.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "log" "net/http" "net/url" @@ -923,7 +923,10 @@ func (res *resource) handleAddToManyRelation(c APIContexter, w http.ResponseWrit if !ok { return errors.New("target struct must implement jsonapi.EditToManyRelations") } - targetObj.AddToManyIDs(relation.Name, newIDs) + err = targetObj.AddToManyIDs(relation.Name, newIDs) + if err != nil { + return err + } if resType == reflect.Struct { _, err = source.Update(reflect.ValueOf(targetObj).Elem().Interface(), buildRequest(c, r)) @@ -1002,7 +1005,10 @@ func (res *resource) handleDeleteToManyRelation(c APIContexter, w http.ResponseW if !ok { return errors.New("target struct must implement jsonapi.EditToManyRelations") } - targetObj.DeleteToManyIDs(relation.Name, obsoleteIDs) + err = targetObj.DeleteToManyIDs(relation.Name, obsoleteIDs) + if err != nil { + return err + } if resType == reflect.Struct { _, err = source.Update(reflect.ValueOf(targetObj).Elem().Interface(), buildRequest(c, r)) @@ -1057,7 +1063,7 @@ func (res *resource) handleDelete(c APIContexter, w http.ResponseWriter, r *http func writeResult(w http.ResponseWriter, data []byte, status int, contentType string) { w.Header().Set("Content-Type", contentType) w.WriteHeader(status) - w.Write(data) + _, _ = w.Write(data) } func (res *resource) respondWith(obj Responder, info information, status int, w http.ResponseWriter, r *http.Request) error { @@ -1100,7 +1106,7 @@ func (res *resource) respondWithPagination(obj Responder, info information, stat func unmarshalRequest(r *http.Request) ([]byte, error) { defer r.Body.Close() - data, err := ioutil.ReadAll(r.Body) + data, err := io.ReadAll(r.Body) if err != nil { return nil, err } diff --git a/api2go_suite_test.go b/api2go_suite_test.go index dcc12f1..74ebc61 100644 --- a/api2go_suite_test.go +++ b/api2go_suite_test.go @@ -1,16 +1,17 @@ package api2go import ( + "io" + "log" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "io/ioutil" - "log" "testing" ) func TestApi2go(t *testing.T) { RegisterFailHandler(Fail) - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) RunSpecs(t, "Api2go Suite") } diff --git a/api_interfaces_test.go b/api_interfaces_test.go index 3494268..8103f95 100644 --- a/api_interfaces_test.go +++ b/api_interfaces_test.go @@ -193,7 +193,9 @@ var _ = Describe("Test return code behavior", func() { post(SomeData{ID: "invalid"}) Expect(rec.Code).To(Equal(http.StatusInternalServerError)) var err HTTPError - json.Unmarshal(rec.Body.Bytes(), &err) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &err) + Expect(jsonErr).ToNot(HaveOccurred()) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(err.Errors[0]).To(Equal(Error{ Title: "invalid status code 418 from resource someDatas for method Create", Status: strconv.Itoa(http.StatusInternalServerError)})) @@ -203,7 +205,8 @@ var _ = Describe("Test return code behavior", func() { post(SomeData{ID: "forbidden", Data: "i am so forbidden"}) Expect(rec.Code).To(Equal(http.StatusForbidden)) var err HTTPError - json.Unmarshal(rec.Body.Bytes(), &err) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &err) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(err.Errors[0]).To(Equal(Error{Title: "Forbidden", Status: strconv.Itoa(http.StatusForbidden)})) }) @@ -211,7 +214,8 @@ var _ = Describe("Test return code behavior", func() { post(SomeData{ID: "conflict", Data: "no force push here"}) Expect(rec.Code).To(Equal(http.StatusConflict)) var err HTTPError - json.Unmarshal(rec.Body.Bytes(), &err) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &err) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(err.Errors[0]).To(Equal(Error{Title: "Conflict", Status: strconv.Itoa(http.StatusConflict)})) }) }) @@ -250,7 +254,8 @@ var _ = Describe("Test return code behavior", func() { patch(SomeData{ID: "12345", Data: "invalid"}) Expect(rec.Code).To(Equal(http.StatusInternalServerError)) var err HTTPError - json.Unmarshal(rec.Body.Bytes(), &err) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &err) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(err.Errors[0]).To(Equal(Error{ Title: "invalid status code 418 from resource someDatas for method Update", Status: strconv.Itoa(http.StatusInternalServerError)})) @@ -262,7 +267,8 @@ var _ = Describe("Test return code behavior", func() { patch(SomeData{ID: "12345", Data: "fail"}) Expect(rec.Code).To(Equal(http.StatusForbidden), "we do not allow failes here!") var err HTTPError - json.Unmarshal(rec.Body.Bytes(), &err) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &err) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(err.Errors[0]).To(Equal(Error{Title: "Fail", Status: strconv.Itoa(http.StatusForbidden)})) }) @@ -279,7 +285,8 @@ var _ = Describe("Test return code behavior", func() { delete("200") Expect(rec.Code).To(Equal(http.StatusOK)) var response map[string]interface{} - json.Unmarshal(rec.Body.Bytes(), &response) + jsonErr := json.Unmarshal(rec.Body.Bytes(), &response) + Expect(jsonErr).ToNot(HaveOccurred()) Expect(response).To(Equal(map[string]interface{}{ "meta": map[string]interface{}{ "some": "cool stuff", diff --git a/api_public.go b/api_public.go index 7d31558..a6f3c24 100644 --- a/api_public.go +++ b/api_public.go @@ -2,7 +2,6 @@ package api2go import ( "net/http" - "strings" "sync" "github.com/manyminds/api2go/jsonapi" @@ -24,12 +23,12 @@ type API struct { } // Handler returns the http.Handler instance for the API. -func (api API) Handler() http.Handler { +func (api *API) Handler() http.Handler { return api.router.Handler() } // Router returns the specified router on an api instance -func (api API) Router() routing.Routeable { +func (api *API) Router() routing.Routeable { return api.router } @@ -105,14 +104,6 @@ func NewAPIWithRouting(prefix string, resolver URLResolver, router routing.Route // newAPI is now an internal method that can be changed if params are changing func newAPI(prefix string, resolver URLResolver, router routing.Routeable) *API { - // Add initial and trailing slash to prefix - prefixSlashes := strings.Trim(prefix, "/") - if len(prefixSlashes) > 0 { - prefixSlashes = "/" + prefixSlashes + "/" - } else { - prefixSlashes = "/" - } - info := information{prefix: prefix, resolver: resolver} api := &API{ diff --git a/api_test.go b/api_test.go index 96a5ef0..1d67859 100644 --- a/api_test.go +++ b/api_test.go @@ -20,8 +20,7 @@ import ( const testPrefix = "v1" type requestURLResolver struct { - r http.Request - calls int + r http.Request } func (m requestURLResolver) GetBaseURL() string { @@ -136,12 +135,14 @@ func (p *Post) AddToManyIDs(name string, IDs []string) error { for _, ID := range IDs { p.Comments = append(p.Comments, Comment{ID: ID}) } + return nil } if name == "bananas" { for _, ID := range IDs { p.Bananas = append(p.Bananas, Banana{ID: ID}) } + return nil } return errors.New("There is no to-manyrelationship with the name " + name) @@ -157,6 +158,7 @@ func (p *Post) DeleteToManyIDs(name string, IDs []string) error { } } } + return nil } if name == "bananas" { @@ -168,6 +170,7 @@ func (p *Post) DeleteToManyIDs(name string, IDs []string) error { } } } + return nil } return errors.New("There is no to-manyrelationship with the name " + name) } @@ -871,7 +874,7 @@ var _ = Describe("RestHandler", func() { api.Handler().ServeHTTP(rec, req) // It's up to the user how to implement this. Api2go just checks if the type is correct Expect(rec.Code).To(Equal(http.StatusConflict)) - Expect(string(rec.Body.Bytes())).To(MatchJSON(`{"errors":[{"status":"409","title":"id in the resource does not match servers endpoint"}]}`)) + Expect(rec.Body.String()).To(MatchJSON(`{"errors":[{"status":"409","title":"id in the resource does not match servers endpoint"}]}`)) }) It("POST without type returns 406", func() { @@ -880,7 +883,7 @@ var _ = Describe("RestHandler", func() { Expect(err).To(BeNil()) api.Handler().ServeHTTP(rec, req) Expect(rec.Code).To(Equal(http.StatusNotAcceptable)) - Expect(string(rec.Body.Bytes())).To(MatchJSON(`{"errors":[{"status":"406","title":"invalid record, no type was specified"}]}`)) + Expect(rec.Body.String()).To(MatchJSON(`{"errors":[{"status":"406","title":"invalid record, no type was specified"}]}`)) }) @@ -909,7 +912,7 @@ var _ = Describe("RestHandler", func() { Expect(err).To(BeNil()) api.Handler().ServeHTTP(rec, req) Expect(rec.Code).To(Equal(http.StatusConflict)) - Expect(string(rec.Body.Bytes())).To(MatchJSON(`{"errors":[{"status":"409","title":"id in the resource does not match servers endpoint"}]}`)) + Expect(rec.Body.String()).To(MatchJSON(`{"errors":[{"status":"409","title":"id in the resource does not match servers endpoint"}]}`)) }) It("UPDATEs correctly using null.* values", func() { @@ -1080,7 +1083,7 @@ var _ = Describe("RestHandler", func() { api.Handler().ServeHTTP(rec, req) Expect(rec.Code).To(Equal(http.StatusBadRequest)) expected := `{"errors":[{"id":"SomeErrorID","source":{"pointer":"Title"}}]}` - actual := strings.TrimSpace(string(rec.Body.Bytes())) + actual := strings.TrimSpace(rec.Body.String()) Expect(actual).To(Equal(expected)) }) }) @@ -1434,7 +1437,6 @@ var _ = Describe("RestHandler", func() { Context("test utility function getPointerToStruct", func() { type someStruct struct { - someEntry string } It("Should work as expected", func() { diff --git a/context.go b/context.go index f0897ce..41be828 100644 --- a/context.go +++ b/context.go @@ -72,7 +72,7 @@ var _ APIContexter = &APIContext{} // ContextQueryParams fetches the QueryParams if Set func ContextQueryParams(c *APIContext) map[string][]string { qp, ok := c.Get("QueryParams") - if ok == false { + if !ok { qp = make(map[string][]string) c.Set("QueryParams", qp) } diff --git a/examples/model/model_user.go b/examples/model/model_user.go index bd393ee..97b6963 100644 --- a/examples/model/model_user.go +++ b/examples/model/model_user.go @@ -98,6 +98,7 @@ func (u *User) DeleteToManyIDs(name string, IDs []string) error { } } } + return nil } return errors.New("There is no to-many relationship with the name " + name) diff --git a/jsonapi/fixtures_test.go b/jsonapi/fixtures_test.go index a5e1cbe..9f8ce98 100644 --- a/jsonapi/fixtures_test.go +++ b/jsonapi/fixtures_test.go @@ -123,15 +123,14 @@ func (u *User) SetID(ID Identifier) error { } type SimplePost struct { - ID string `json:"-"` - LID string `json:"-"` - Title string `json:"title"` - Text string `json:"text"` - Internal string `json:"-"` - Size int `json:"size"` - Created time.Time `json:"created-date"` - Updated time.Time `json:"updated-date"` - topSecret string + ID string `json:"-"` + LID string `json:"-"` + Title string `json:"title"` + Text string `json:"text"` + Internal string `json:"-"` + Size int `json:"size"` + Created time.Time `json:"created-date"` + Updated time.Time `json:"updated-date"` } func (s SimplePost) GetID() Identifier { diff --git a/jsonapi/marshal_enum_test.go b/jsonapi/marshal_enum_test.go index ed7543b..c1954e5 100644 --- a/jsonapi/marshal_enum_test.go +++ b/jsonapi/marshal_enum_test.go @@ -92,7 +92,8 @@ var _ = Describe("Custom enum types", func() { Context("When unmarshaling objects including enums", func() { It("unmarshals status string values to int enum type", func() { var result PublishStatus - result.UnmarshalText([]byte(statusValue)) + err := result.UnmarshalText([]byte(statusValue)) + Expect(err).ToNot(HaveOccurred()) Expect(result).To(Equal(status)) }) diff --git a/jsonapi/unmarshal_test.go b/jsonapi/unmarshal_test.go index 2e73b5b..299cf5a 100644 --- a/jsonapi/unmarshal_test.go +++ b/jsonapi/unmarshal_test.go @@ -218,6 +218,8 @@ var _ = Describe("Unmarshal", func() { It("errors with invalid time format", func() { t, err := time.Parse(time.RFC3339, "2014-11-10T16:30:48.823Z") + Expect(err).ToNot(HaveOccurred()) + faultyPostMap := []byte(`{ "data": { "attributes": { diff --git a/routing/echo_test.go b/routing/echo_test.go index e26524d..6a4f8c3 100644 --- a/routing/echo_test.go +++ b/routing/echo_test.go @@ -1,10 +1,9 @@ //go:build echo && !gingonic && !gorillamux -// +build echo,!gingonic,!gorillamux package routing_test import ( - "io/ioutil" + "io" "log" "net/http" "net/http/httptest" @@ -45,7 +44,7 @@ var _ = Describe("api2go with echo router adapter", func() { }) BeforeEach(func() { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) rec = httptest.NewRecorder() }) diff --git a/routing/gingonic_test.go b/routing/gingonic_test.go index 660f1a4..5316704 100644 --- a/routing/gingonic_test.go +++ b/routing/gingonic_test.go @@ -1,10 +1,9 @@ //go:build gingonic && !gorillamux && !echo -// +build gingonic,!gorillamux,!echo package routing_test import ( - "io/ioutil" + "io" "log" "net/http" "net/http/httptest" @@ -65,7 +64,7 @@ var _ = Describe("api2go with gingonic router adapter", func() { }) BeforeEach(func() { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) rec = httptest.NewRecorder() }) diff --git a/routing/gorillamux.go b/routing/gorillamux.go index 51d0b05..32509d6 100644 --- a/routing/gorillamux.go +++ b/routing/gorillamux.go @@ -1,5 +1,4 @@ //go:build gorillamux && !gingonic && !echo -// +build gorillamux,!gingonic,!echo package routing diff --git a/routing/gorillamux_test.go b/routing/gorillamux_test.go index 27d3786..ceba181 100644 --- a/routing/gorillamux_test.go +++ b/routing/gorillamux_test.go @@ -1,10 +1,9 @@ //go:build gorillamux && !gingonic && !echo -// +build gorillamux,!gingonic,!echo package routing_test import ( - "io/ioutil" + "io" "log" "net/http" "net/http/httptest" @@ -45,7 +44,7 @@ var _ = Describe("api2go with gorillamux router adapter", func() { }) BeforeEach(func() { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) rec = httptest.NewRecorder() })