newer go-swagger has some fancier templates

Signed-off-by: Mikolaj Pawlikowski <mikolaj@pawlikowski.pl>
This commit is contained in:
Mikolaj Pawlikowski
2019-02-20 16:44:25 +00:00
parent 15b4598606
commit 513d8ee489
10 changed files with 24 additions and 24 deletions

View File

@@ -6,11 +6,10 @@ package operations
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"

View File

@@ -6,11 +6,10 @@ package operations
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"

View File

@@ -6,11 +6,10 @@ package operations
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"

View File

@@ -6,11 +6,10 @@ package operations
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"

View File

@@ -33,14 +33,14 @@ func (o *CheckAllPodsURL) SetBasePath(bp string) {
// Build a url path and query string
func (o *CheckAllPodsURL) Build() (*url.URL, error) {
var result url.URL
var _result url.URL
var _path = "/check_all"
_basePath := o._basePath
result.Path = golangswaggerpaths.Join(_basePath, _path)
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &result, nil
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error

View File

@@ -50,8 +50,12 @@ func (o *CheckServicePodsOK) WriteResponse(rw http.ResponseWriter, producer runt
rw.WriteHeader(200)
payload := o.Payload
if payload == nil {
// return empty map
payload = models.CheckResults{}
}
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@@ -33,14 +33,14 @@ func (o *CheckServicePodsURL) SetBasePath(bp string) {
// Build a url path and query string
func (o *CheckServicePodsURL) Build() (*url.URL, error) {
var result url.URL
var _result url.URL
var _path = "/check"
_basePath := o._basePath
result.Path = golangswaggerpaths.Join(_basePath, _path)
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &result, nil
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error

View File

@@ -33,14 +33,14 @@ func (o *HealthzURL) SetBasePath(bp string) {
// Build a url path and query string
func (o *HealthzURL) Build() (*url.URL, error) {
var result url.URL
var _result url.URL
var _path = "/healthz"
_basePath := o._basePath
result.Path = golangswaggerpaths.Join(_basePath, _path)
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &result, nil
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error

View File

@@ -33,14 +33,14 @@ func (o *PingURL) SetBasePath(bp string) {
// Build a url path and query string
func (o *PingURL) Build() (*url.URL, error) {
var result url.URL
var _result url.URL
var _path = "/ping"
_basePath := o._basePath
result.Path = golangswaggerpaths.Join(_basePath, _path)
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &result, nil
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error

View File

@@ -187,6 +187,7 @@ func (s *Server) Serve() (err error) {
configureServer(domainSocket, "unix", string(s.SocketPath))
servers = append(servers, domainSocket)
wg.Add(1)
s.Logf("Serving goldpinger at unix://%s", s.SocketPath)
go func(l net.Listener) {
@@ -196,7 +197,6 @@ func (s *Server) Serve() (err error) {
}
s.Logf("Stopped serving goldpinger at unix://%s", s.SocketPath)
}(s.domainSocketL)
servers = append(servers, domainSocket)
}
if s.hasScheme(schemeHTTP) {
@@ -217,6 +217,7 @@ func (s *Server) Serve() (err error) {
configureServer(httpServer, "http", s.httpServerL.Addr().String())
servers = append(servers, httpServer)
wg.Add(1)
s.Logf("Serving goldpinger at http://%s", s.httpServerL.Addr())
go func(l net.Listener) {
@@ -226,7 +227,6 @@ func (s *Server) Serve() (err error) {
}
s.Logf("Stopped serving goldpinger at http://%s", l.Addr())
}(s.httpServerL)
servers = append(servers, httpServer)
}
if s.hasScheme(schemeHTTPS) {
@@ -313,6 +313,7 @@ func (s *Server) Serve() (err error) {
configureServer(httpsServer, "https", s.httpsServerL.Addr().String())
servers = append(servers, httpsServer)
wg.Add(1)
s.Logf("Serving goldpinger at https://%s", s.httpsServerL.Addr())
go func(l net.Listener) {
@@ -322,7 +323,6 @@ func (s *Server) Serve() (err error) {
}
s.Logf("Stopped serving goldpinger at https://%s", l.Addr())
}(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig))
servers = append(servers, httpsServer)
}
wg.Wait()