style(ginmode): set gin mode release
This commit is contained in:
parent
b9d931da68
commit
f61302d25f
@ -169,6 +169,8 @@ func (cli *Client) Connect() {
|
|||||||
cli.port = fmt.Sprintf("%d", listener.Addr().(*net.TCPAddr).Port)
|
cli.port = fmt.Sprintf("%d", listener.Addr().(*net.TCPAddr).Port)
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
|
||||||
router.POST("/:label", func(c *gin.Context) {
|
router.POST("/:label", func(c *gin.Context) {
|
||||||
label := c.Param("label")
|
label := c.Param("label")
|
||||||
if f, ok := cli.register.Load(label); ok {
|
if f, ok := cli.register.Load(label); ok {
|
||||||
|
@ -5,8 +5,30 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestSelectChan(t *testing.T) {
|
||||||
|
var a chan string = make(chan string)
|
||||||
|
var b chan string = make(chan string)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Second * 2)
|
||||||
|
a <- "1"
|
||||||
|
time.Sleep(time.Second * 2)
|
||||||
|
b <- "2"
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case s := <-a:
|
||||||
|
log.Println("a", s)
|
||||||
|
case s := <-b:
|
||||||
|
log.Println("b", s)
|
||||||
|
case <-time.After(time.Second * 5):
|
||||||
|
log.Println("timeout 5s")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestPort(t *testing.T) {
|
func TestPort(t *testing.T) {
|
||||||
cli := New("http://localhost:7123")
|
cli := New("http://localhost:7123")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user