Skip to content

Commit

Permalink
Remove .dev/protoc & Detect and show download link
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Oct 19, 2020
1 parent 3d378fc commit d035844
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 6 additions & 2 deletions infra/vprotogen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ func main() {
}

GOBIN := common.GetGOBIN()
protoc := core.ProtocMap[runtime.GOOS]

EXE := ""
if runtime.GOOS == "windows" {
EXE = ".exe"
}
protoc := "protoc" + EXE

if err := exec.Command(protoc).Run(); err != nil {
fmt.Println("Make sure that you have `" + protoc + "` in your system or current path, please visit https://github.com/protocolbuffers/protobuf/releases")
os.Exit(1)
}

protoFilesMap := make(map[string][]string)
walkErr := filepath.Walk("./", func(path string, info os.FileInfo, err error) error {
Expand Down
9 changes: 0 additions & 9 deletions proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ package core
//go:generate go install -v github.com/gogo/protobuf/protoc-gen-gofast
//go:generate go run ./infra/vprotogen/main.go

import "path/filepath"

// ProtoFilesUsingProtocGenGoFast is the map of Proto files
// that use `protoc-gen-gofast` to generate pb.go files
var ProtoFilesUsingProtocGenGoFast = map[string]bool{"proxy/vless/encoding/addons.proto": true}

// ProtocMap is the map of paths to `protoc` binary excutable files of specific platform
var ProtocMap = map[string]string{
"windows": filepath.Join(".dev", "protoc", "windows", "protoc.exe"),
"darwin": filepath.Join(".dev", "protoc", "macos", "protoc"),
"linux": filepath.Join(".dev", "protoc", "linux", "protoc"),
}

0 comments on commit d035844

Please sign in to comment.