mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-18 12:59:31 +00:00
In order to remove dependencies on `Sirupsen/logrus` while emicklei/go-restful-openapi/pull/49 is getting reviewed and, hopefully, merged: ``` $ gvt delete github.com/emicklei/go-restful-openapi $ gvt fetch --branch lowercase-sirupsen --revision 129557de7d9f2d2ca4a90cd31c379db90a561ad8 github.com/marccarre/go-restful-openapi 2018/07/23 15:50:36 Fetching: github.com/marccarre/go-restful-openapi 2018/07/23 15:50:38 · Skipping (existing): github.com/emicklei/go-restful 2018/07/23 15:50:38 · Skipping (existing): github.com/sirupsen/logrus 2018/07/23 15:50:38 · Skipping (existing): github.com/go-openapi/spec 2018/07/23 15:50:38 · Fetching recursive dependency: github.com/emicklei/go-restful-openapi 2018/07/23 15:50:40 ·· Skipping (existing): github.com/emicklei/go-restful 2018/07/23 15:50:40 ·· Fetching recursive dependency: github.com/Sirupsen/logrus 2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/sys/unix 2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/crypto/ssh/terminal 2018/07/23 15:50:43 ··· Skipping (existing): github.com/sirupsen/logrus 2018/07/23 15:50:43 ·· Skipping (existing): github.com/go-openapi/spec ```
21 lines
494 B
Go
21 lines
494 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
|
|
restful "github.com/emicklei/go-restful"
|
|
restfulspec "github.com/emicklei/go-restful-openapi"
|
|
)
|
|
|
|
func main() {
|
|
config := restfulspec.Config{
|
|
WebServices: restful.RegisteredWebServices(), // you control what services are visible
|
|
APIPath: "/apidocs.json",
|
|
PostBuildSwaggerObjectHandler: enrichSwaggerObject}
|
|
swagger := restfulspec.BuildSwagger(config)
|
|
enc := json.NewEncoder(os.Stdout)
|
|
enc.SetIndent("", "\t")
|
|
enc.Encode(swagger)
|
|
}
|