forked from forgejo/forgejo
Use vfsgen instead of go-bindata (#7080)
* use vfsgen instead of go-bindata * fix templates * fix fmt * vendor vsfgen
This commit is contained in:
parent
8eba27c792
commit
83b90e4199
36 changed files with 1224 additions and 612 deletions
45
vendor/github.com/shurcooL/vfsgen/commentwriter.go
generated
vendored
Normal file
45
vendor/github.com/shurcooL/vfsgen/commentwriter.go
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
package vfsgen
|
||||
|
||||
import "io"
|
||||
|
||||
// commentWriter writes a Go comment to the underlying io.Writer,
|
||||
// using line comment form (//).
|
||||
type commentWriter struct {
|
||||
W io.Writer
|
||||
wroteSlashes bool // Wrote "//" at the beginning of the current line.
|
||||
}
|
||||
|
||||
func (c *commentWriter) Write(p []byte) (int, error) {
|
||||
var n int
|
||||
for i, b := range p {
|
||||
if !c.wroteSlashes {
|
||||
s := "//"
|
||||
if b != '\n' {
|
||||
s = "// "
|
||||
}
|
||||
if _, err := io.WriteString(c.W, s); err != nil {
|
||||
return n, err
|
||||
}
|
||||
c.wroteSlashes = true
|
||||
}
|
||||
n0, err := c.W.Write(p[i : i+1])
|
||||
n += n0
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if b == '\n' {
|
||||
c.wroteSlashes = false
|
||||
}
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (c *commentWriter) Close() error {
|
||||
if !c.wroteSlashes {
|
||||
if _, err := io.WriteString(c.W, "//"); err != nil {
|
||||
return err
|
||||
}
|
||||
c.wroteSlashes = true
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue