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

v2.GetEchoInstance   A

Complexity

Conditions 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
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
// New returns a new Echo instance.
15
func GetEchoInstance() *echo.Echo {
16
	once.Do(func() {
17
		instance = echo.New()
18
		registerMiddlewares(instance)
19
20
		registerStaticRoutes(instance)
21
22
		registerRoutes(instance)
23
	})
24
	return instance
25
}
26
27
func registerMiddlewares(_ *echo.Echo) {
28
}
29