diff --git a/app/commander/commander.go b/app/commander/commander.go index 20c0f02d8..26794d04c 100644 --- a/app/commander/commander.go +++ b/app/commander/commander.go @@ -1,6 +1,6 @@ package commander -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg commander -path App,Commander +//go:generate errorgen import ( "context" diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index e899bd869..fe020215b 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -1,6 +1,6 @@ package dispatcher -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg impl -path App,Dispatcher,Default +//go:generate errorgen import ( "context" diff --git a/app/dispatcher/dispatcher.go b/app/dispatcher/dispatcher.go index 498522c5d..4a08c6b69 100644 --- a/app/dispatcher/dispatcher.go +++ b/app/dispatcher/dispatcher.go @@ -2,7 +2,7 @@ package dispatcher import "context" -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dispatcher -path App,Dispatcher +//go:generate errorgen type key int diff --git a/app/dns/dns.go b/app/dns/dns.go index ae2421ef0..280242358 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -1,4 +1,4 @@ // Package dns is an implementation of core.DNS feature. package dns -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dns -path App,DNS +//go:generate errorgen diff --git a/app/dns/server.go b/app/dns/server.go index deb5665b8..1a286619e 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -1,6 +1,6 @@ package dns -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dns -path App,DNS +//go:generate errorgen import ( "context" diff --git a/app/log/command/command.go b/app/log/command/command.go index a85f854e4..ac33f5b57 100644 --- a/app/log/command/command.go +++ b/app/log/command/command.go @@ -1,6 +1,6 @@ package command -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg command -path App,Log,Command +//go:generate errorgen import ( "context" diff --git a/app/log/log.go b/app/log/log.go index d8b6afd1e..82e95aeab 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -1,6 +1,6 @@ package log -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg log -path App,Log +//go:generate errorgen import ( "context" diff --git a/app/policy/policy.go b/app/policy/policy.go index 492e45965..c7a435245 100644 --- a/app/policy/policy.go +++ b/app/policy/policy.go @@ -1,4 +1,4 @@ // Package policy is an implementation of core.PolicyManager feature. package policy -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg policy -path App,Policy +//go:generate errorgen diff --git a/app/proxyman/command/doc.go b/app/proxyman/command/doc.go index 8c18efaf4..a9d2624e9 100644 --- a/app/proxyman/command/doc.go +++ b/app/proxyman/command/doc.go @@ -1,3 +1,3 @@ package command -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg command -path App,Proxyman,Command +//go:generate errorgen diff --git a/app/proxyman/inbound/inbound.go b/app/proxyman/inbound/inbound.go index 888564ece..c64367136 100644 --- a/app/proxyman/inbound/inbound.go +++ b/app/proxyman/inbound/inbound.go @@ -1,6 +1,6 @@ package inbound -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg inbound -path App,Proxyman,Inbound +//go:generate errorgen import ( "context" diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index 732c6d20c..cdcd63726 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -1,6 +1,6 @@ package mux -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg mux -path App,Proxyman,Mux +//go:generate errorgen import ( "context" diff --git a/app/proxyman/outbound/outbound.go b/app/proxyman/outbound/outbound.go index 91bc2c441..6c5df2759 100644 --- a/app/proxyman/outbound/outbound.go +++ b/app/proxyman/outbound/outbound.go @@ -1,6 +1,6 @@ package outbound -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg outbound -path App,Proxyman,Outbound +//go:generate errorgen import ( "context" diff --git a/app/router/router.go b/app/router/router.go index ac1d8db62..ae7f64127 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -1,6 +1,6 @@ package router -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg router -path App,Router +//go:generate errorgen import ( "context" diff --git a/app/stats/command/command.go b/app/stats/command/command.go index 2c7feb0de..e44b0f493 100644 --- a/app/stats/command/command.go +++ b/app/stats/command/command.go @@ -1,6 +1,6 @@ package command -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg command -path App,Stats,Command +//go:generate errorgen import ( "context" diff --git a/app/stats/stats.go b/app/stats/stats.go index 3a12b74e1..94bcb7925 100644 --- a/app/stats/stats.go +++ b/app/stats/stats.go @@ -1,6 +1,6 @@ package stats -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg stats -path App,Stats +//go:generate errorgen import ( "context" diff --git a/common/buf/buf.go b/common/buf/buf.go index 584815f4a..393354799 100644 --- a/common/buf/buf.go +++ b/common/buf/buf.go @@ -1,4 +1,4 @@ // Package buf provides a light-weight memory allocation mechanism. package buf // import "v2ray.com/core/common/buf" -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg buf -path Buf +//go:generate errorgen diff --git a/common/common.go b/common/common.go index 2f58ba7f2..f7f8b02c2 100644 --- a/common/common.go +++ b/common/common.go @@ -2,7 +2,7 @@ // See each sub-package for detail. package common -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg common -path Common +//go:generate errorgen // Must panics if err is not nil. func Must(err error) { diff --git a/common/crypto/crypto.go b/common/crypto/crypto.go index 45797a8ad..d98e8dfe2 100644 --- a/common/crypto/crypto.go +++ b/common/crypto/crypto.go @@ -1,4 +1,4 @@ // Package crypto provides common crypto libraries for V2Ray. package crypto // import "v2ray.com/core/common/crypto" -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg crypto -path Crypto +//go:generate errorgen diff --git a/common/net/net.go b/common/net/net.go index b44beedbf..da929836c 100644 --- a/common/net/net.go +++ b/common/net/net.go @@ -1,4 +1,4 @@ // Package net is a drop-in replacement to Golang's net package, with some more functionalities. package net // import "v2ray.com/core/common/net" -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg net -path Net +//go:generate errorgen diff --git a/common/platform/ctlcmd/ctlcmd.go b/common/platform/ctlcmd/ctlcmd.go index 60d219cf4..0e1506c39 100644 --- a/common/platform/ctlcmd/ctlcmd.go +++ b/common/platform/ctlcmd/ctlcmd.go @@ -9,7 +9,7 @@ import ( "v2ray.com/core/common/platform" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg ctlcmd -path Command,Platform,CtlCmd +//go:generate errorgen func Run(args []string, input io.Reader) (buf.MultiBuffer, error) { v2ctl := platform.GetToolLocation("v2ctl") diff --git a/common/protocol/tls/cert/cert.go b/common/protocol/tls/cert/cert.go index d12da482d..36598c66a 100644 --- a/common/protocol/tls/cert/cert.go +++ b/common/protocol/tls/cert/cert.go @@ -11,7 +11,7 @@ import ( "v2ray.com/core/common" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg cert -path Protocol,TLS,Cert +//go:generate errorgen type Certificate struct { // Cerificate in ASN.1 DER format diff --git a/common/retry/retry.go b/common/retry/retry.go index b2c785997..c719e2674 100644 --- a/common/retry/retry.go +++ b/common/retry/retry.go @@ -1,6 +1,6 @@ package retry // import "v2ray.com/core/common/retry" -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg retry -path Retry +//go:generate errorgen import ( "time" diff --git a/core.go b/core.go index 9a427d362..e9a70caa2 100755 --- a/core.go +++ b/core.go @@ -9,7 +9,8 @@ // connections. package core -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg core -path Core +//go:generate go install "v2ray.com/core/common/errors/errorgen" +//go:generate errorgen import ( "v2ray.com/core/common/serial" diff --git a/main/confloader/external/external.go b/main/confloader/external/external.go index 21cc709a2..4c78ef6ee 100644 --- a/main/confloader/external/external.go +++ b/main/confloader/external/external.go @@ -10,7 +10,7 @@ import ( "v2ray.com/core/main/confloader" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg external -path Main,ConfLoader,External +//go:generate errorgen type ClosableMultiBuffer struct { buf.MultiBuffer diff --git a/main/json/config_json.go b/main/json/config_json.go index a0981487d..81ac55f40 100644 --- a/main/json/config_json.go +++ b/main/json/config_json.go @@ -1,6 +1,6 @@ package json -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg json -path Main,Json +//go:generate errorgen import ( "io" diff --git a/main/main.go b/main/main.go index 638134083..e9dca8643 100644 --- a/main/main.go +++ b/main/main.go @@ -1,6 +1,6 @@ package main -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg main -path Main +//go:generate errorgen import ( "flag" diff --git a/proxy/blackhole/blackhole.go b/proxy/blackhole/blackhole.go index e584295e9..4451efd46 100644 --- a/proxy/blackhole/blackhole.go +++ b/proxy/blackhole/blackhole.go @@ -1,7 +1,7 @@ // Package blackhole is an outbound handler that blocks all connections. package blackhole -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg blackhole -path Proxy,Blackhole +//go:generate errorgen import ( "context" diff --git a/proxy/dokodemo/dokodemo.go b/proxy/dokodemo/dokodemo.go index f347b05dd..4d372d875 100644 --- a/proxy/dokodemo/dokodemo.go +++ b/proxy/dokodemo/dokodemo.go @@ -1,6 +1,6 @@ package dokodemo -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dokodemo -path Proxy,Dokodemo +//go:generate errorgen import ( "context" diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 41cfecab3..a55619c4f 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -1,6 +1,6 @@ package freedom -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg freedom -path Proxy,Freedom +//go:generate errorgen import ( "context" diff --git a/proxy/http/http.go b/proxy/http/http.go index 8ed94a4ab..cb8ad4e92 100644 --- a/proxy/http/http.go +++ b/proxy/http/http.go @@ -1,3 +1,3 @@ package http -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg http -path Proxy,HTTP +//go:generate errorgen diff --git a/proxy/mtproto/mtproto.go b/proxy/mtproto/mtproto.go index 0f3dc37aa..75629fe72 100644 --- a/proxy/mtproto/mtproto.go +++ b/proxy/mtproto/mtproto.go @@ -1,3 +1,3 @@ package mtproto -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg mtproto -path Proxy,MTProto +//go:generate errorgen diff --git a/proxy/shadowsocks/shadowsocks.go b/proxy/shadowsocks/shadowsocks.go index b01bc5b5f..c74184413 100644 --- a/proxy/shadowsocks/shadowsocks.go +++ b/proxy/shadowsocks/shadowsocks.go @@ -13,4 +13,4 @@ // R.I.P Shadowsocks package shadowsocks -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg shadowsocks -path Proxy,Shadowsocks +//go:generate errorgen diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index c09977298..ac2da5a4a 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -1,4 +1,4 @@ // Package socks provides implements of Socks protocol 4, 4a and 5. package socks -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg socks -path Proxy,Socks +//go:generate errorgen diff --git a/proxy/vmess/encoding/encoding.go b/proxy/vmess/encoding/encoding.go index a016f15b4..f6d049476 100644 --- a/proxy/vmess/encoding/encoding.go +++ b/proxy/vmess/encoding/encoding.go @@ -5,7 +5,7 @@ import ( "v2ray.com/core/common/protocol" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg encoding -path Proxy,VMess,Encoding +//go:generate errorgen const ( Version = byte(1) diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index 0dc00f1e4..4f6243263 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/proxy/vmess/inbound/inbound.go @@ -1,6 +1,6 @@ package inbound -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg inbound -path Proxy,VMess,Inbound +//go:generate errorgen import ( "context" diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index adad38aea..0e531b369 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -1,6 +1,6 @@ package outbound -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg outbound -path Proxy,VMess,Outbound +//go:generate errorgen import ( "context" diff --git a/proxy/vmess/vmess.go b/proxy/vmess/vmess.go index 03ad2fabc..2c40b120a 100644 --- a/proxy/vmess/vmess.go +++ b/proxy/vmess/vmess.go @@ -5,7 +5,7 @@ // clients with 'socks' for proxying. package vmess -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg vmess -path Proxy,VMess +//go:generate errorgen import ( "strings" diff --git a/transport/internet/domainsocket/errgen.go b/transport/internet/domainsocket/errgen.go index 33e38e416..d4501e830 100644 --- a/transport/internet/domainsocket/errgen.go +++ b/transport/internet/domainsocket/errgen.go @@ -1,3 +1,3 @@ package domainsocket -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg domainsocket -path Transport,Internet,DomainSocket +//go:generate errorgen diff --git a/transport/internet/headers/http/http.go b/transport/internet/headers/http/http.go index a8a21ae87..b1b28fda5 100644 --- a/transport/internet/headers/http/http.go +++ b/transport/internet/headers/http/http.go @@ -1,6 +1,6 @@ package http -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg http -path Transport,Internet,Headers,HTTP +//go:generate errorgen import ( "bytes" diff --git a/transport/internet/http/http.go b/transport/internet/http/http.go index e532ed9c1..cb8ad4e92 100644 --- a/transport/internet/http/http.go +++ b/transport/internet/http/http.go @@ -1,3 +1,3 @@ package http -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg http -path Transport,Internet,HTTP +//go:generate errorgen diff --git a/transport/internet/internet.go b/transport/internet/internet.go index 226e42aea..77027eaad 100644 --- a/transport/internet/internet.go +++ b/transport/internet/internet.go @@ -1,3 +1,3 @@ package internet -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg internet -path Transport,Internet +//go:generate errorgen diff --git a/transport/internet/kcp/kcp.go b/transport/internet/kcp/kcp.go index c0c581686..177b65170 100644 --- a/transport/internet/kcp/kcp.go +++ b/transport/internet/kcp/kcp.go @@ -5,4 +5,4 @@ // xtaci@github for translating to Golang package kcp -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg kcp -path Transport,Internet,mKCP +//go:generate errorgen diff --git a/transport/internet/tcp/tcp.go b/transport/internet/tcp/tcp.go index 72409305c..05307a111 100644 --- a/transport/internet/tcp/tcp.go +++ b/transport/internet/tcp/tcp.go @@ -1,3 +1,3 @@ package tcp -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg tcp -path Transport,Internet,TCP +//go:generate errorgen diff --git a/transport/internet/tls/tls.go b/transport/internet/tls/tls.go index efb3b4227..f21ea5f99 100644 --- a/transport/internet/tls/tls.go +++ b/transport/internet/tls/tls.go @@ -7,7 +7,7 @@ import ( "v2ray.com/core/common/net" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg tls -path Transport,Internet,TLS +//go:generate errorgen var ( _ buf.Writer = (*conn)(nil) diff --git a/transport/internet/udp/udp.go b/transport/internet/udp/udp.go index 250ea679f..cbcebe440 100644 --- a/transport/internet/udp/udp.go +++ b/transport/internet/udp/udp.go @@ -1,5 +1,5 @@ package udp -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg udp -path Transport,Internet,UDP +//go:generate errorgen const protocolName = "udp" diff --git a/transport/internet/websocket/ws.go b/transport/internet/websocket/ws.go index e9863b031..7edd13441 100755 --- a/transport/internet/websocket/ws.go +++ b/transport/internet/websocket/ws.go @@ -4,4 +4,4 @@ Websocket transport implements an HTTP(S) compliable, surveillance proof transpo */ package websocket -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg websocket -path Transport,Internet,WebSocket +//go:generate errorgen