1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-27 17:55:23 +00:00

remove old error generator

This commit is contained in:
Darien Raymond 2017-12-03 12:48:47 +01:00
parent d43a23aa96
commit fcc18a7d05
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -1,44 +0,0 @@
package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
)
var (
pkg = flag.String("pkg", "", "Target package")
path = flag.String("path", "", "Path")
)
func main() {
flag.Parse()
if len(*pkg) == 0 {
panic("Package is not specified.")
}
if len(*path) == 0 {
panic("Path is not specified.")
}
paths := strings.Split(*path, ",")
for i := range paths {
paths[i] = "\"" + paths[i] + "\""
}
pathStr := strings.Join(paths, ", ")
file, err := os.OpenFile("errors.generated.go", os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644)
if err != nil {
log.Fatalf("Failed to generate errors.generated.go: %v", err)
}
defer file.Close()
fmt.Fprintln(file, "package", *pkg)
fmt.Fprintln(file, "")
fmt.Fprintln(file, "import \"v2ray.com/core/common/errors\"")
fmt.Fprintln(file, "")
fmt.Fprintln(file, "func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("+pathStr+") }")
}