ci: build web

This commit is contained in:
levi committed 2022-11-01 15:13:59 +08:00
1 parent ff4e6f448c
commit bf8e24a6af
13 files changed
+140 -74

No files matched your search

+5 -5
View File
@@ -1,6 +1,7 @@
package controller
import (
"errors"
"os"
"path/filepath"
)
@@ -11,11 +12,10 @@ type Controller interface {
}
type DefaultController struct {
Files map[string]*os.File
}
func NewController() *DefaultController {
return &DefaultController{Files: make(map[string]*os.File)}
return &DefaultController{}
}
func (c *DefaultController) Touch(name string, size int64) (file *os.File, err error) {
@@ -24,15 +24,15 @@ func (c *DefaultController) Touch(name string, size int64) (file *os.File, err e
return
}
file, err = os.Create(name)
if err != nil && !errors.Is(err, os.ErrExist) {
return
}
if size > 0 {
err = os.Truncate(name, size)
if err != nil {
return nil, err
}
}
if err == nil {
c.Files[name] = file
}
return
}