Repository: labstack/echo
File: echo.go (Go)

Code before:
	"time"

	"github.com/labstack/gommon/color"
	"github.com/labstack/gommon/log"
	"golang.org/x/crypto/acme"
	"golang.org/x/crypto/acme/autocert"
	"golang.org/x/net/http2"
	"golang.org/x/net/http2/h2c"
)

type (
	// Echo is the top-level framework instance.
	//
	// Goroutine safety: Do not mutate Echo instance fields after server has started. Accessing these
	// fields from handlers/middlewares and changing field values at the same time leads to data-races.
	// Same rule applies to adding new routes after server has been started - Adding a route is not Goroutine safe action.
	Echo struct {
		filesystem
		common
		// startupMutex is mutex to lock Echo instance access during server configuration and startup. Useful for to get
		// listener address info (on which interface/port was listener binded) without having data races.
		startupMutex sync.RWMutex
		colorer      *color.Color

		// premiddleware are middlewares that are run before routing is done. In case pre-middleware returns an error router
		// will not be called at all and execution ends up in global error handler.
		premiddleware []MiddlewareFunc
		middleware    []MiddlewareFunc
		maxParam      *int
		router        *Router
		routers       map[string]*Router
		pool          sync.Pool

		StdLogger        *stdLog.Logger
		Server           *http.Server
		TLSServer        *http.Server
		Listener         net.Listener
		TLSListener      net.Listener
		AutoTLSManager   autocert.Manager
		DisableHTTP2     bool
		Debug            bool
		HideBanner       bool
		HidePort         bool
		HTTPErrorHandler HTTPErrorHandler
		Binder           Binder
		JSONSerializer   JSONSerializer
		Validator        Validator
		Renderer         Renderer
		Logger           Logger
		IPExtractor      IPExtractor
		ListenerNetwork  string

Review comment (suggestion):
Suggestion:

```diff
-   // premiddleware are middlewares that are run before routing is done. In case pre-middleware returns an error router
-		// will not be called at all and execution ends up in global error handler.
+   // premiddleware are middlewares that are run before routing is done. In case a pre-middleware returns 
+   // an error the router is not executed and the request will end up in the global error handler
```
		

Code after:
	"time"

	"github.com/labstack/gommon/color"
	"github.com/labstack/gommon/log"
	"golang.org/x/crypto/acme"
	"golang.org/x/crypto/acme/autocert"
	"golang.org/x/net/http2"
	"golang.org/x/net/http2/h2c"
)

type (
	// Echo is the top-level framework instance.
	//
	// Goroutine safety: Do not mutate Echo instance fields after server has started. Accessing these
	// fields from handlers/middlewares and changing field values at the same time leads to data-races.
	// Adding new routes after the server has been started is also not safe!
	Echo struct {
		filesystem
		common
		// startupMutex is mutex to lock Echo instance access during server configuration and startup. Useful for to get
		// listener address info (on which interface/port was listener binded) without having data races.
		startupMutex sync.RWMutex
		colorer      *color.Color

		// premiddleware are middlewares that are run before routing is done. In case a pre-middleware returns
		// an error the router is not executed and the request will end up in the global error handler.
		premiddleware []MiddlewareFunc
		middleware    []MiddlewareFunc
		maxParam      *int
		router        *Router
		routers       map[string]*Router
		pool          sync.Pool

		StdLogger        *stdLog.Logger
		Server           *http.Server
		TLSServer        *http.Server
		Listener         net.Listener
		TLSListener      net.Listener
		AutoTLSManager   autocert.Manager
		DisableHTTP2     bool
		Debug            bool
		HideBanner       bool
		HidePort         bool
		HTTPErrorHandler HTTPErrorHandler
		Binder           Binder
		JSONSerializer   JSONSerializer
		Validator        Validator
		Renderer         Renderer
		Logger           Logger
		IPExtractor      IPExtractor
		ListenerNetwork  string