Passed
Pull Request — main (#166)
by Yume
02:31
created

app/v2/app.go   A

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 14
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A v2.New 0 10 2
A v2.registerMiddlewares 0 1 1
1
package v2
2
3
import (
4
	"sync"
5
6
	"github.com/labstack/echo/v4"
7
)
8
9
var (
10
	instance *echo.Echo //nolint:gochecknoglobals //Singleton
11
	once     sync.Once  //nolint:gochecknoglobals //Singleton
12
13
)
14
15
// New returns a new Echo instance.
16
func New() *echo.Echo {
17
	once.Do(func() {
18
		instance = echo.New()
19
		registerMiddlewares(instance)
20
21
		registerStaticRoutes(instance)
22
23
		registerRoutes(instance)
24
	})
25
	return instance
26
}
27
28
func registerMiddlewares(_ *echo.Echo) {
29
}
30