forked from v2ray/v2ray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b943581
commit 503f767
Showing
4 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package shadowsocks | ||
|
||
import "v2ray.com/core/common/errors" | ||
|
||
func newError(values ...interface{}) *errors.Error { | ||
return errors.New(values...).Path("Proxy", "Shadowsocks") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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+") }") | ||
} |