go-openapi / errors

openapi toolkit common errors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My build fails

settys opened this issue · comments

With the following error.

not enough arguments in call to "github.com/go-openapi/errors".Required
have (string, string)
want (string, string, interface {})

This had happened before, and the errors project was rolled back. previous issue is located at #22

You have to upgrade your swagger binary so that it generates code which supports this new version of the library. The error messages contain a bit more information

I have already tried that. Tried to build new binary as:

dir=$(mktemp -d)
git clone https://github.com/go-swagger/go-swagger "$dir"
cd "$dir"
go install ./cmd/swagger

https://goswagger.io/install.html

swagger version

returns:

version: v0.19.0
commit: 312366608bbf17dd219190b66ab63bdc8b4d0db0

I think you have an old binary in your path before where you installed the new one. The version output is wrong, this is what you're meant to see:

$ docker run --rm -it golang
root@4e0836f3fd37:/go# dir=$(mktemp -d)
root@4e0836f3fd37:/go# git clone https://github.com/go-swagger/go-swagger "$dir"
Cloning into '/tmp/tmp.Sx8gvpTk2i'...
remote: Enumerating objects: 162, done.
remote: Counting objects: 100% (162/162), done.
remote: Compressing objects: 100% (137/137), done.
remote: Total 48301 (delta 53), reused 58 (delta 17), pack-reused 48139
Receiving objects: 100% (48301/48301), 49.67 MiB | 2.16 MiB/s, done.
Resolving deltas: 100% (29434/29434), done.
root@4e0836f3fd37:/go# cd "$dir"
root@4e0836f3fd37:/tmp/tmp.Sx8gvpTk2i# go install ./cmd/swagger
go: downloading github.com/go-openapi/loads v0.19.5
go: downloading github.com/jessevdk/go-flags v1.4.0
go: downloading github.com/go-openapi/analysis v0.19.10
go: downloading github.com/toqueteos/webbrowser v1.2.0
go: downloading github.com/gorilla/handlers v1.4.2
go: downloading github.com/go-openapi/validate v0.19.10
go: downloading golang.org/x/tools v0.0.0-20200612220849-54c614fe050c
go: downloading github.com/kr/pretty v0.2.0
go: downloading github.com/go-openapi/errors v0.19.6
go: downloading github.com/go-openapi/runtime v0.19.16
go: downloading github.com/go-openapi/spec v0.19.8
go: downloading github.com/go-openapi/jsonpointer v0.19.3
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading github.com/spf13/viper v1.7.0
go: downloading github.com/go-openapi/swag v0.19.9
go: downloading github.com/go-openapi/strfmt v0.19.5
go: downloading github.com/go-openapi/jsonreference v0.19.3
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/go-openapi/inflect v0.19.0
go: downloading github.com/mailru/easyjson v0.7.1
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading github.com/mitchellh/mapstructure v1.3.2
go: downloading gopkg.in/ini.v1 v1.57.0
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/spf13/afero v1.2.2
go: downloading go.mongodb.org/mongo-driver v1.3.4
go: downloading github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
go: downloading github.com/spf13/cast v1.3.1
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading golang.org/x/text v0.3.2
go: downloading golang.org/x/sys v0.0.0-20200610111108-226ff32320da
go: downloading golang.org/x/net v0.0.0-20200602114024-627f9648deb9
go: downloading github.com/pelletier/go-toml v1.8.0
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading golang.org/x/mod v0.3.0
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: downloading github.com/go-stack/stack v1.8.0
root@4e0836f3fd37:/tmp/tmp.Sx8gvpTk2i# swagger version
dev

our latest version is v0.24.0

You can install it the easiest with
GO111MODULE=on go get github.com/go-swagger/go-swagger/cmd/swagger@v0.24.0

Note that there is no -u in the command because otherwise it would upgrade our dependencies

Thank you. I was able to get the latest of the docker image. I am closing the issue.

commented

@casualjim how often does this errors repo make backwards incompatible changes to it's public API such as this?
As I'm sure you know this breaks consumers and in this forces them to regenerate their APIs with a different version of the swagger tooling; IMHO less than optimal.

first time in the lifetime of the project. It slipped by and reverting it causes more issues