Skip to content

Commit

Permalink
api, daemon: drop unnecessary dependency on github.com/go-openapi/run…
Browse files Browse the repository at this point in the history
…time/flagext

Same case as for commit e63a1d4 ("api, daemon: drop unused
dependency on github.com/jessevdk/go-flags"), PR #10890.

The package is pulled in because the swagger server template uses it by
default.  However, we don't use any of the features of this package,
thus drop it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>s
  • Loading branch information
tklauser authored and aanm committed Apr 9, 2020
1 parent 3fe0838 commit 987fd7c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 56 deletions.
9 changes: 4 additions & 5 deletions api/v1/health/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions api/v1/server.gotmpl
Expand Up @@ -22,7 +22,6 @@ import (


"github.com/go-openapi/swag"
"github.com/go-openapi/runtime/flagext"
{{ if .UsePFlags }}flag "github.com/spf13/pflag"
{{ end -}}
"golang.org/x/net/netutil"
Expand Down Expand Up @@ -56,7 +55,7 @@ var ({{ if .ExcludeSpec }}
{{ end }}enabledListeners []string
cleanupTimeout time.Duration
gracefulTimeout time.Duration
maxHeaderSize flagext.ByteSize
maxHeaderSize int

socketPath string

Expand All @@ -79,7 +78,7 @@ var ({{ if .ExcludeSpec }}
)

func init() {
maxHeaderSize = flagext.ByteSize(1000000){{ if .ExcludeSpec }}
maxHeaderSize = 1000000{{ if .ExcludeSpec }}
flag.StringVarP(&specFile, "spec", "", "", "the swagger specification to serve")
{{ end }}

Expand Down Expand Up @@ -191,7 +190,7 @@ type Server struct {
EnabledListeners []string
CleanupTimeout time.Duration
GracefulTimeout time.Duration
MaxHeaderSize flagext.ByteSize
MaxHeaderSize int

SocketPath string
domainSocketL net.Listener
Expand Down Expand Up @@ -299,7 +298,7 @@ func (s *Server) Serve() (err error) {

if s.hasScheme(schemeUnix) {
domainSocket := new(http.Server)
domainSocket.MaxHeaderBytes = int(s.MaxHeaderSize)
domainSocket.MaxHeaderBytes = s.MaxHeaderSize
domainSocket.Handler = s.handler
if int64(s.CleanupTimeout) > 0 {
domainSocket.IdleTimeout = s.CleanupTimeout
Expand Down Expand Up @@ -327,7 +326,7 @@ func (s *Server) Serve() (err error) {

if s.hasScheme(schemeHTTP) {
httpServer := new(http.Server)
httpServer.MaxHeaderBytes = int(s.MaxHeaderSize)
httpServer.MaxHeaderBytes = s.MaxHeaderSize
httpServer.ReadTimeout = s.ReadTimeout
httpServer.WriteTimeout = s.WriteTimeout
httpServer.SetKeepAlivesEnabled(int64(s.KeepAlive) > 0)
Expand Down Expand Up @@ -357,7 +356,7 @@ func (s *Server) Serve() (err error) {

if s.hasScheme(schemeHTTPS) {
httpsServer := new(http.Server)
httpsServer.MaxHeaderBytes = int(s.MaxHeaderSize)
httpsServer.MaxHeaderBytes = s.MaxHeaderSize
httpsServer.ReadTimeout = s.TLSReadTimeout
httpsServer.WriteTimeout = s.TLSWriteTimeout
httpsServer.SetKeepAlivesEnabled(int64(s.TLSKeepAlive) > 0)
Expand Down
9 changes: 4 additions & 5 deletions api/v1/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions vendor/github.com/go-openapi/runtime/flagext/byte_size.go

This file was deleted.

1 change: 0 additions & 1 deletion vendor/modules.txt
Expand Up @@ -223,7 +223,6 @@ github.com/go-openapi/loads
## explicit
github.com/go-openapi/runtime
github.com/go-openapi/runtime/client
github.com/go-openapi/runtime/flagext
github.com/go-openapi/runtime/logger
github.com/go-openapi/runtime/middleware
github.com/go-openapi/runtime/middleware/denco
Expand Down

0 comments on commit 987fd7c

Please sign in to comment.