Skip to content

Commit

Permalink
Merge pull request #6 from xushiwei/yap
Browse files Browse the repository at this point in the history
rm check(err)
  • Loading branch information
xushiwei authored Jan 6, 2024
2 parents 14c0a79 + b924ae8 commit 5b4932f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
11 changes: 1 addition & 10 deletions cmd/gopcomm/community.gop
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import (
"embed"
"io/fs"
"log"

"github.com/goplus/yap"
)

func check(err error) {
if err != nil {
log.panicln err
}
}

//go:embed yap
var yapFS embed.FS

fsYap, err := fs.sub(yapFS, "yap")
check(err)

fsYap := fs.sub(yapFS, "yap")!
y := yap.new(fsYap)

y.handle "/p/", ctx => {
Expand Down
36 changes: 20 additions & 16 deletions cmd/gopcomm/gop_autogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@ package main
import (
"embed"
"io/fs"
"log"
"github.com/goplus/yap"
"github.com/qiniu/x/errors"
)
//line cmd/gopcomm/community.gop:9:1
func check(err error) {
//line cmd/gopcomm/community.gop:10:1
if err != nil {
//line cmd/gopcomm/community.gop:11:1
log.Panicln(err)
}
}

var yapFS embed.FS
//line cmd/gopcomm/community.gop:18
//line cmd/gopcomm/community.gop:11
func main() {
//line cmd/gopcomm/community.gop:18:1
fsYap, err := fs.Sub(yapFS, "yap")
//line cmd/gopcomm/community.gop:19:1
check(err)
//line cmd/gopcomm/community.gop:21:1
//line cmd/gopcomm/community.gop:11:1
fsYap := func() (_gop_ret fs.FS) {
//line cmd/gopcomm/community.gop:11:1
var _gop_err error
//line cmd/gopcomm/community.gop:11:1
_gop_ret, _gop_err = fs.Sub(yapFS, "yap")
//line cmd/gopcomm/community.gop:11:1
if _gop_err != nil {
//line cmd/gopcomm/community.gop:11:1
_gop_err = errors.NewFrame(_gop_err, "fs.sub(yapFS, \"yap\")", "cmd/gopcomm/community.gop", 11, "main.main")
//line cmd/gopcomm/community.gop:11:1
panic(_gop_err)
}
//line cmd/gopcomm/community.gop:11:1
return
}()
//line cmd/gopcomm/community.gop:12:1
y := yap.New(fsYap)
//line cmd/gopcomm/community.gop:23:1
//line cmd/gopcomm/community.gop:14:1
y.Handle("/p/", func(ctx *yap.Context) {
})
}
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/goplus/community

go 1.18

require github.com/goplus/yap v0.1.0
require (
github.com/goplus/yap v0.1.0
github.com/qiniu/x v1.13.2
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
github.com/goplus/yap v0.1.0 h1:POiEaS0ZlHPOo6Vw8guq+i9sOUfzF3ZHiSmK0NC+9I8=
github.com/goplus/yap v0.1.0/go.mod h1:VCbGlZo2lUgRWciTZwA5JEOuCUf8T2PhxZZ0HXqzgBk=
github.com/qiniu/x v1.13.2 h1:mgWOfB9Rpk6AEtlBoObZVxH+b2FHSntYrxc4KX5Ta98=
github.com/qiniu/x v1.13.2/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=

0 comments on commit 5b4932f

Please sign in to comment.