增加go modules支持

This commit is contained in:
john 2018-10-19 17:21:30 +08:00
parent 8594df0ac2
commit 9bb1125169
9 changed files with 38 additions and 131 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ bin/
cbuild
*/.DS_Store
.vscode/
go.sum

View File

@ -1,14 +0,0 @@
package main
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
)
func main() {
beego.Get("/:name",func(ctx *context.Context){
ctx.Output.Body([]byte(ctx.Input.Param(":name")))
})
beego.BeeLogger.SetLevel(0)
beego.Run(":8199")
}

View File

@ -1,14 +0,0 @@
package main
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
)
func main() {
beego.Get("/",func(ctx *context.Context){
ctx.Output.Body([]byte("哈喽世界!"))
})
beego.BeeLogger.SetLevel(0)
beego.Run(":8199")
}

View File

@ -1,40 +0,0 @@
package main
import (
"fmt"
"sync"
"gitee.com/johng/gf/g/os/gtime"
"gitee.com/johng/gf/g/net/ghttp"
"gitee.com/johng/gf/g/container/gtype"
)
func main() {
clientMax := 1000
requestMax := 1000
failureNum := gtype.NewInt64()
successNum := gtype.NewInt64()
startTime := gtime.Millisecond()
wg := sync.WaitGroup{}
for i := 0; i < clientMax; i++ {
wg.Add(1)
go func(clientId int) {
url := "http://127.0.0.1:8199/"
for i := 0; i < requestMax; i++ {
//url = fmt.Sprintf("http://127.0.0.1:8199/%d_%d", clientId, i)
if c, e := ghttp.Get(url); e == nil {
c.Close()
successNum.Add(1)
} else {
fmt.Println(e)
failureNum.Add(1)
}
}
wg.Done()
}(i)
}
wg.Wait()
fmt.Printf("time spent: %d ms, success:%d, failure: %d\n",
gtime.Millisecond() - startTime, successNum.Val(), failureNum.Val())
}

View File

@ -1,15 +0,0 @@
package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/:name", func(r *ghttp.Request){
r.Response.Write(r.Get("name"))
})
s.SetPort(8199)
s.Run()
}

View File

@ -1,16 +0,0 @@
package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request){
r.Response.Write("哈喽世界!")
})
s.EnablePprof()
s.SetPort(8199)
s.Run()
}

View File

@ -1,16 +0,0 @@
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Use(gin.Recovery())
r.GET("/:name", func(c *gin.Context) {
c.String(http.StatusOK, c.Param("name"))
})
r.Run(":8199")
}

View File

@ -1,16 +0,0 @@
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Use(gin.Recovery())
r.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "哈喽世界!")
})
r.Run(":8199")
}

37
go.mod Normal file
View File

@ -0,0 +1,37 @@
module gitee.com/johng/gf
require (
github.com/BurntSushi/toml v0.3.1
github.com/Shopify/sarama v1.19.0
github.com/Shopify/toxiproxy v2.1.3+incompatible // indirect
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394
github.com/clbanning/mxj v1.8.2
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/structs v1.1.0
github.com/fsnotify/fsnotify v1.4.7
github.com/ghodss/yaml v1.0.0
github.com/go-sql-driver/mysql v1.4.0
github.com/gofrs/flock v0.7.0 // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/gomodule/redigo v2.0.0+incompatible
github.com/gorilla/websocket v1.4.0
github.com/grokify/html-strip-tags-go v0.0.0-20180907063347-e9e44961e26f
github.com/kr/pretty v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.3 // indirect
github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/theckman/go-flock v0.7.0
golang.org/x/sys v0.0.0
gopkg.in/check.v1 v1.0.0
gopkg.in/yaml.v2 v2.2.1
)
replace (
golang.org/x/sys => ./vendor/golang.org/x/sys
gopkg.in/check.v1 => ./vendor/gopkg.in/check.v1
gopkg.in/yaml.v2 => ./vendor/gopkg.in/yaml.v2
)