├── .bazelrc ├── .bazelversion ├── .gitignore ├── BUILD.bazel ├── README.md ├── WORKSPACE ├── go.mod ├── protos └── api │ ├── BUILD.bazel │ ├── README.md │ ├── api.pb.client.go │ ├── api.pb.go │ ├── api.pb.server.go │ └── api.proto ├── server ├── BUILD.bazel └── server.go ├── third_party ├── 0001-Updates-the-zlib-version-in-use-to-1.2.13.patch ├── BUILD ├── go_repositories.bzl ├── gogo.patch ├── grpc-crosscompile.patch ├── org_golang_x_net-crosscompile.patch ├── proto.patch └── update_go_mods ├── tools ├── BUILD.bazel ├── protoc-gen-client │ ├── BUILD.bazel │ └── main.go └── protoc-gen-server │ ├── BUILD.bazel │ └── main.go └── wasm ├── BUILD.bazel ├── icon.png ├── instance_table.go ├── main.go ├── manager.go └── search_bar.go /.bazelrc: -------------------------------------------------------------------------------- 1 | # Allows temporary user settings to be placed here. From 2 | # https://bazel.build/configure/best-practices#bazelrc-file 3 | try-import %workspace%/user.bazelrc 4 | 5 | build --cxxopt=-std=c++14 6 | build --host_cxxopt=-std=c++14 7 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 6.3.0 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bazel-* 2 | go.sum 3 | user.bazelrc 4 | -------------------------------------------------------------------------------- /BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | load("@bazel_gazelle//:def.bzl", "gazelle") 3 | load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") 4 | 5 | # gazelle:prefix github.com/grahamjenson/bazel-golang-wasm-proto 6 | gazelle(name = "gazelle") 7 | 8 | buildifier(name = "buildifier") 9 | 10 | go_library( 11 | name = "go_default_library", 12 | srcs = ["//wasm:files"], 13 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto", 14 | visibility = ["//visibility:private"], 15 | deps = [ 16 | "//protos/api:go_default_library", 17 | "//server:go_default_library", 18 | "@com_github_maxence_charriere_go_app_v9//pkg/app:go_default_library", 19 | ], 20 | ) 21 | 22 | go_binary( 23 | name = "server", 24 | args = [ 25 | "--bootstrap-css-path=$(location @com_github_bootstrap//file:bootstrap.css)", 26 | "--wasm-path=$(location //wasm:app.wasm)", 27 | "--icon-path=$(location //wasm:icon)", 28 | ], 29 | data = [ 30 | "//wasm:app.wasm", 31 | "//wasm:icon", 32 | "@com_github_bootstrap//file:bootstrap.css", 33 | "@com_github_ec2instances//file:instances.json", 34 | ], 35 | embed = [":go_default_library"], 36 | visibility = ["//visibility:public"], 37 | ) 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bazel Golang WASM with Proto 2 | 3 | Pre-Reqs: 4 | 5 | 1. Bazel 6 | 7 | How to run: 8 | 9 | 1. `bazel run :server` 10 | 2. `open localhost:7000` 11 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "bazel_golang_wasm_proto") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") 4 | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") 5 | 6 | ### 7 | # Rules 8 | ### 9 | 10 | http_archive( 11 | name = "io_bazel_rules_go", 12 | sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6", 13 | urls = [ 14 | "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", 15 | "https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", 16 | ], 17 | ) 18 | 19 | http_archive( 20 | name = "bazel_gazelle", 21 | sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405", 22 | urls = [ 23 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", 24 | "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", 25 | ], 26 | ) 27 | 28 | git_repository( 29 | name = "com_google_protobuf", 30 | commit = "21edc3b26fc80771baea78d8bd8df1285b12cae2", 31 | remote = "https://github.com/protocolbuffers/protobuf", 32 | ) 33 | 34 | http_archive( 35 | name = "rules_proto_grpc", 36 | sha256 = "5f0f2fc0199810c65a2de148a52ba0aff14d631d4e8202f41aff6a9d590a471b", 37 | strip_prefix = "rules_proto_grpc-1.0.2", 38 | urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/1.0.2.tar.gz"], 39 | ) 40 | 41 | ### 42 | # Overrides to get WASM working with protoc 43 | ### 44 | 45 | http_archive( 46 | name = "com_github_gogo_protobuf", 47 | patch_args = ["-p1"], 48 | patches = [ 49 | "//third_party:gogo.patch", 50 | ], 51 | sha256 = "2056a39c922c7315530fc5b7a6ce10cc83b58c844388c9b2e903a0d8867a8b66", 52 | strip_prefix = "protobuf-1.3.1", 53 | # v1.3.1, latest as of 2020-01-03 54 | urls = [ 55 | "https://mirror.bazel.build/github.com/gogo/protobuf/archive/v1.3.1.zip", 56 | "https://github.com/gogo/protobuf/archive/v1.3.1.zip", 57 | ], 58 | ) 59 | 60 | ### 61 | # Bootrap 62 | ### 63 | 64 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") 65 | 66 | go_rules_dependencies() 67 | 68 | go_register_toolchains(go_version = "1.20.5") 69 | 70 | load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") 71 | 72 | gazelle_dependencies() 73 | 74 | # gazelle:repository_macro third_party/go_repositories.bzl%go_repositories 75 | load("//third_party:go_repositories.bzl", "go_repositories") 76 | 77 | go_repositories() 78 | 79 | ### 80 | # Protobuf 81 | ### 82 | 83 | load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") 84 | 85 | protobuf_deps() 86 | 87 | ### 88 | # GRPC 89 | ### 90 | 91 | load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains") 92 | 93 | rules_proto_grpc_toolchains() 94 | 95 | rules_proto_grpc_repos() 96 | 97 | load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") 98 | 99 | grpc_deps() 100 | 101 | load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") 102 | 103 | grpc_extra_deps() 104 | 105 | ### 106 | # Data Files 107 | ### 108 | 109 | http_file( 110 | name = "com_github_bootstrap", 111 | downloaded_file_path = "bootstrap.css", 112 | sha256 = "038ecec312ff9c0374c9d8831534865fb7ed6df4c94ca822274cea0ae4cf0e1e", 113 | urls = ["https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css"], 114 | ) 115 | 116 | http_file( 117 | name = "com_github_ec2instances", 118 | downloaded_file_path = "instances.json", 119 | sha256 = "8cf2c06b485cfef6567a1554589b4e3ce4ad8e61116a5edf32ed6233010b0fba", 120 | urls = ["https://raw.githubusercontent.com/powdahound/ec2instances.info/b6664cf095405e806d69ea2c8b1d3f02b5951cf1/www/instances.json"], 121 | ) 122 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/grahamjenson/bazel-golang-wasm-proto 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/golang/protobuf v1.5.3 7 | github.com/lyft/protoc-gen-star v0.6.2 8 | github.com/maxence-charriere/go-app/v9 v9.7.3 9 | google.golang.org/grpc v1.57.0 10 | ) 11 | 12 | require ( 13 | github.com/google/uuid v1.3.0 // indirect 14 | github.com/spf13/afero v1.3.3 // indirect 15 | golang.org/x/mod v0.8.0 // indirect 16 | golang.org/x/net v0.9.0 // indirect 17 | golang.org/x/sys v0.7.0 // indirect 18 | golang.org/x/text v0.9.0 // indirect 19 | golang.org/x/tools v0.6.0 // indirect 20 | google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect 21 | google.golang.org/protobuf v1.31.0 // indirect 22 | ) 23 | -------------------------------------------------------------------------------- /protos/api/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 3 | load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") 4 | 5 | proto_library( 6 | name = "api_proto", 7 | srcs = ["api.proto"], 8 | visibility = ["//visibility:public"], 9 | ) 10 | 11 | go_library( 12 | name = "go_default_library", 13 | embed = [":api_go_proto"], 14 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api", 15 | visibility = ["//visibility:public"], 16 | ) 17 | 18 | go_proto_library( 19 | name = "api_go_proto", 20 | compilers = [ 21 | "@io_bazel_rules_go//proto:go_grpc", 22 | "//tools:go_server", #keep 23 | "//tools:go_client", #keep 24 | ], 25 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api", 26 | proto = ":api_proto", 27 | visibility = ["//visibility:public"], 28 | ) 29 | -------------------------------------------------------------------------------- /protos/api/README.md: -------------------------------------------------------------------------------- 1 | The symlinks in this directory are required to have `go mod tidy` work on the 2 | bazel directory structure. 3 | 4 | For as long as bazel does not change the internal paths for the generated 5 | protobufs, this should work. 6 | -------------------------------------------------------------------------------- /protos/api/api.pb.client.go: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/protos/api/linux_amd64_stripped/api_go_proto%/github.com/grahamjenson/bazel-golang-wasm-proto/protos/api/api.pb.client.go -------------------------------------------------------------------------------- /protos/api/api.pb.go: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/protos/api/linux_amd64_stripped/api_go_proto%/github.com/grahamjenson/bazel-golang-wasm-proto/protos/api/api.pb.go -------------------------------------------------------------------------------- /protos/api/api.pb.server.go: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/protos/api/linux_amd64_stripped/api_go_proto%/github.com/grahamjenson/bazel-golang-wasm-proto/protos/api/api.pb.server.go -------------------------------------------------------------------------------- /protos/api/api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package api; 4 | 5 | option go_package = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api"; 6 | 7 | message Instance { 8 | string name = 1; 9 | string instance_type = 2; 10 | float ecu = 3; 11 | float memory = 4; 12 | string network = 5; 13 | string price = 6; 14 | } 15 | 16 | message Instances { 17 | repeated Instance instances = 1; 18 | } 19 | 20 | message SearchRequest { 21 | string query = 1; 22 | } 23 | 24 | service Api { 25 | rpc Search (SearchRequest) returns (Instances); 26 | } 27 | -------------------------------------------------------------------------------- /server/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | go_library( 4 | name = "go_default_library", 5 | srcs = ["server.go"], 6 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/server", 7 | visibility = ["//visibility:public"], 8 | deps = ["//protos/api:go_default_library"], 9 | ) 10 | -------------------------------------------------------------------------------- /server/server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "io/ioutil" 7 | "strings" 8 | 9 | "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api" 10 | ) 11 | 12 | //// 13 | // ec2Instances file 14 | //// 15 | 16 | type ec2Instance struct { 17 | PrettyName string `json:"pretty_name,omitempty"` 18 | InstanceType string `json:"instance_type,omitempty"` 19 | ECU float32 `json:"ECU,omitempty"` 20 | Memory float32 `json:"memory,omitempty"` 21 | 22 | NetworkPerformance string `json:"network_performance,omitempty"` 23 | 24 | Pricing map[string]map[string]struct { 25 | OnDemand string `json:"ondemand,omitempty"` 26 | } `json:"pricing,omitempty"` 27 | } 28 | 29 | //// 30 | // Server 31 | //// 32 | 33 | type Server struct { 34 | instances []*api.Instance 35 | } 36 | 37 | func (server *Server) Search(ctx context.Context, in *api.SearchRequest) (*api.Instances, error) { 38 | if server.instances == nil { 39 | server.parseInstances() 40 | } 41 | 42 | instances := []*api.Instance{} 43 | for _, instance := range server.instances { 44 | str, _ := json.Marshal(*instance) 45 | if strings.Contains(string(str), in.Query) { 46 | instances = append(instances, instance) 47 | } 48 | } 49 | 50 | return &api.Instances{Instances: instances}, nil 51 | } 52 | 53 | func (server *Server) parseInstances() { 54 | fileName := "external/com_github_ec2instances/file/instances.json" 55 | ec2Instances := []ec2Instance{} 56 | server.instances = []*api.Instance{} 57 | 58 | file, _ := ioutil.ReadFile(fileName) 59 | json.Unmarshal(file, &ec2Instances) 60 | 61 | for _, e := range ec2Instances { 62 | server.instances = append(server.instances, &api.Instance{ 63 | Name: e.PrettyName, 64 | InstanceType: e.InstanceType, 65 | Ecu: e.ECU, 66 | Memory: e.Memory, 67 | Network: e.NetworkPerformance, 68 | Price: e.Pricing["us-east-1"]["linux"].OnDemand, 69 | }) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /third_party/0001-Updates-the-zlib-version-in-use-to-1.2.13.patch: -------------------------------------------------------------------------------- 1 | From 4935ed1941b99105634d06920e20d94842738def Mon Sep 17 00:00:00 2001 2 | From: Filip Filmar 3 | Date: Sun, 30 Jul 2023 14:24:18 -0700 4 | Subject: [PATCH] Updates the zlib version in use to 1.2.13 5 | 6 | Version 1.2.11 was retracted due to a security vulnerability. 7 | --- 8 | protobuf_deps.bzl | 8 +++++--- 9 | 1 file changed, 5 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl 12 | index 25fad7253..484dcc051 100644 13 | --- a/protobuf_deps.bzl 14 | +++ b/protobuf_deps.bzl 15 | @@ -9,7 +9,9 @@ def protobuf_deps(): 16 | http_archive( 17 | name = "zlib", 18 | build_file = "@com_google_protobuf//:third_party/zlib.BUILD", 19 | - sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", 20 | - strip_prefix = "zlib-1.2.11", 21 | - urls = ["https://zlib.net/zlib-1.2.11.tar.gz"], 22 | + # zlib-1.2.11 was removed due to 23 | + # https://nvd.nist.gov/vuln/detail/CVE-2022-37434 24 | + sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30", 25 | + strip_prefix = "zlib-1.2.13", 26 | + urls = ["https://zlib.net/zlib-1.2.13.tar.gz"], 27 | ) 28 | -- 29 | 2.41.0.487.g6d72f3e995-goog 30 | 31 | -------------------------------------------------------------------------------- /third_party/BUILD: -------------------------------------------------------------------------------- 1 | package(default_visibility = ["//visibility:public"]) 2 | -------------------------------------------------------------------------------- /third_party/go_repositories.bzl: -------------------------------------------------------------------------------- 1 | load("@bazel_gazelle//:deps.bzl", "go_repository") 2 | 3 | ### 4 | # Go Repos 5 | ### 6 | 7 | def go_repositories(): 8 | go_repository( 9 | name = "co_honnef_go_tools", 10 | importpath = "honnef.co/go/tools", 11 | sum = "h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=", 12 | version = "v0.0.1-2020.1.4", 13 | ) 14 | go_repository( 15 | name = "com_github_burntsushi_toml", 16 | importpath = "github.com/BurntSushi/toml", 17 | sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", 18 | version = "v0.3.1", 19 | ) 20 | 21 | go_repository( 22 | name = "com_github_burntsushi_xgb", 23 | importpath = "github.com/BurntSushi/xgb", 24 | sum = "h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=", 25 | version = "v0.0.0-20160522181843-27f122750802", 26 | ) 27 | go_repository( 28 | name = "com_github_census_instrumentation_opencensus_proto", 29 | importpath = "github.com/census-instrumentation/opencensus-proto", 30 | sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=", 31 | version = "v0.2.1", 32 | ) 33 | 34 | go_repository( 35 | name = "com_github_chzyer_logex", 36 | importpath = "github.com/chzyer/logex", 37 | sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", 38 | version = "v1.1.10", 39 | ) 40 | go_repository( 41 | name = "com_github_chzyer_readline", 42 | importpath = "github.com/chzyer/readline", 43 | sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", 44 | version = "v0.0.0-20180603132655-2972be24d48e", 45 | ) 46 | go_repository( 47 | name = "com_github_chzyer_test", 48 | importpath = "github.com/chzyer/test", 49 | sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", 50 | version = "v0.0.0-20180213035817-a1ea475d72b1", 51 | ) 52 | go_repository( 53 | name = "com_github_client9_misspell", 54 | importpath = "github.com/client9/misspell", 55 | sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", 56 | version = "v0.3.4", 57 | ) 58 | 59 | go_repository( 60 | name = "com_github_cncf_udpa_go", 61 | importpath = "github.com/cncf/udpa/go", 62 | sum = "h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M=", 63 | version = "v0.0.0-20201120205902-5459f2c99403", 64 | ) 65 | go_repository( 66 | name = "com_github_davecgh_go_spew", 67 | importpath = "github.com/davecgh/go-spew", 68 | sum = "h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=", 69 | version = "v1.1.0", 70 | ) 71 | go_repository( 72 | name = "com_github_envoyproxy_go_control_plane", 73 | importpath = "github.com/envoyproxy/go-control-plane", 74 | sum = "h1:EmNYJhPYy0pOFjCx2PrgtaBXmee0iUX9hLlxE1xHOJE=", 75 | version = "v0.9.9-0.20201210154907-fd9021fe5dad", 76 | ) 77 | go_repository( 78 | name = "com_github_envoyproxy_protoc_gen_validate", 79 | importpath = "github.com/envoyproxy/protoc-gen-validate", 80 | sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=", 81 | version = "v0.1.0", 82 | ) 83 | 84 | go_repository( 85 | name = "com_github_go_gl_glfw", 86 | importpath = "github.com/go-gl/glfw", 87 | sum = "h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=", 88 | version = "v0.0.0-20190409004039-e6da0acd62b1", 89 | ) 90 | go_repository( 91 | name = "com_github_go_gl_glfw_v3_3_glfw", 92 | importpath = "github.com/go-gl/glfw/v3.3/glfw", 93 | sum = "h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=", 94 | version = "v0.0.0-20200222043503-6f7a984d4dc4", 95 | ) 96 | go_repository( 97 | name = "com_github_golang_glog", 98 | importpath = "github.com/golang/glog", 99 | sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=", 100 | version = "v0.0.0-20160126235308-23def4e6c14b", 101 | ) 102 | 103 | go_repository( 104 | name = "com_github_golang_groupcache", 105 | importpath = "github.com/golang/groupcache", 106 | sum = "h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=", 107 | version = "v0.0.0-20200121045136-8c9f03a8e57e", 108 | ) 109 | go_repository( 110 | name = "com_github_golang_jwt_jwt", 111 | importpath = "github.com/golang-jwt/jwt", 112 | sum = "h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=", 113 | version = "v3.2.2+incompatible", 114 | ) 115 | go_repository( 116 | name = "com_github_golang_mock", 117 | importpath = "github.com/golang/mock", 118 | sum = "h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=", 119 | version = "v1.4.4", 120 | ) 121 | go_repository( 122 | name = "com_github_golang_protobuf", 123 | importpath = "github.com/golang/protobuf", 124 | sum = "h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=", 125 | version = "v1.4.3", 126 | ) 127 | 128 | go_repository( 129 | name = "com_github_gomarkdown_markdown", 130 | importpath = "github.com/gomarkdown/markdown", 131 | sum = "h1:iyaGYbCmcYK0Ja9a3OUa2Fo+EaN0cbLu0eKpBwPFzc8=", 132 | version = "v0.0.0-20221013030248-663e2500819c", 133 | ) 134 | go_repository( 135 | name = "com_github_google_btree", 136 | importpath = "github.com/google/btree", 137 | sum = "h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=", 138 | version = "v1.0.0", 139 | ) 140 | go_repository( 141 | name = "com_github_google_go_cmp", 142 | importpath = "github.com/google/go-cmp", 143 | sum = "h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=", 144 | version = "v0.5.4", 145 | ) 146 | 147 | go_repository( 148 | name = "com_github_google_martian", 149 | importpath = "github.com/google/martian", 150 | sum = "h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=", 151 | version = "v2.1.0+incompatible", 152 | ) 153 | go_repository( 154 | name = "com_github_google_martian_v3", 155 | importpath = "github.com/google/martian/v3", 156 | sum = "h1:wCKgOCHuUEVfsaQLpPSJb7VdYCdTVZQAuOdYm1yc/60=", 157 | version = "v3.1.0", 158 | ) 159 | go_repository( 160 | name = "com_github_google_pprof", 161 | importpath = "github.com/google/pprof", 162 | sum = "h1:LR89qFljJ48s990kEKGsk213yIJDPI4205OKOzbURK8=", 163 | version = "v0.0.0-20201218002935-b9804c9f04c2", 164 | ) 165 | go_repository( 166 | name = "com_github_google_renameio", 167 | importpath = "github.com/google/renameio", 168 | sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=", 169 | version = "v0.1.0", 170 | ) 171 | go_repository( 172 | name = "com_github_google_uuid", 173 | importpath = "github.com/google/uuid", 174 | sum = "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=", 175 | version = "v1.3.0", 176 | ) 177 | go_repository( 178 | name = "com_github_googleapis_gax_go_v2", 179 | importpath = "github.com/googleapis/gax-go/v2", 180 | sum = "h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=", 181 | version = "v2.0.5", 182 | ) 183 | go_repository( 184 | name = "com_github_googleapis_google_cloud_go_testing", 185 | importpath = "github.com/googleapis/google-cloud-go-testing", 186 | sum = "h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4=", 187 | version = "v0.0.0-20200911160855-bcd43fbb19e8", 188 | ) 189 | go_repository( 190 | name = "com_github_grpc_grpc", 191 | importpath = "github.com/grpc/grpc", 192 | sum = "h1:0/fjvIF5JHJdr34/JPEk1DJFFonjW37pDLvuAy9YieQ=", 193 | version = "v1.26.0", 194 | ) 195 | 196 | go_repository( 197 | name = "com_github_hashicorp_golang_lru", 198 | importpath = "github.com/hashicorp/golang-lru", 199 | sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", 200 | version = "v0.5.1", 201 | ) 202 | go_repository( 203 | name = "com_github_ianlancetaylor_demangle", 204 | importpath = "github.com/ianlancetaylor/demangle", 205 | sum = "h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=", 206 | version = "v0.0.0-20200824232613-28f6c0f3b639", 207 | ) 208 | go_repository( 209 | name = "com_github_jstemmer_go_junit_report", 210 | importpath = "github.com/jstemmer/go-junit-report", 211 | sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=", 212 | version = "v0.9.1", 213 | ) 214 | go_repository( 215 | name = "com_github_kisielk_gotool", 216 | importpath = "github.com/kisielk/gotool", 217 | sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", 218 | version = "v1.0.0", 219 | ) 220 | go_repository( 221 | name = "com_github_kr_fs", 222 | importpath = "github.com/kr/fs", 223 | sum = "h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=", 224 | version = "v0.1.0", 225 | ) 226 | go_repository( 227 | name = "com_github_kr_pretty", 228 | importpath = "github.com/kr/pretty", 229 | sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", 230 | version = "v0.1.0", 231 | ) 232 | go_repository( 233 | name = "com_github_kr_pty", 234 | importpath = "github.com/kr/pty", 235 | sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", 236 | version = "v1.1.1", 237 | ) 238 | go_repository( 239 | name = "com_github_kr_text", 240 | importpath = "github.com/kr/text", 241 | sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", 242 | version = "v0.1.0", 243 | ) 244 | go_repository( 245 | name = "com_github_lyft_protoc_gen_star", 246 | importpath = "github.com/lyft/protoc-gen-star", 247 | sum = "h1:HUkD4H4dYFIgu3Bns/3N6J5GmKHCEGnhYBwNu3fvXgA=", 248 | version = "v0.4.14", 249 | ) 250 | 251 | go_repository( 252 | name = "com_github_maxence_charriere_go_app_v9", 253 | importpath = "github.com/maxence-charriere/go-app/v9", 254 | sum = "h1:gDlROy31hAUg6SoOcD9joIKApL3AE5pWIEyEMTLgagQ=", 255 | version = "v9.7.3", 256 | ) 257 | go_repository( 258 | name = "com_github_pkg_errors", 259 | importpath = "github.com/pkg/errors", 260 | sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", 261 | version = "v0.9.1", 262 | ) 263 | go_repository( 264 | name = "com_github_pkg_sftp", 265 | importpath = "github.com/pkg/sftp", 266 | sum = "h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs=", 267 | version = "v1.13.1", 268 | ) 269 | go_repository( 270 | name = "com_github_pmezard_go_difflib", 271 | importpath = "github.com/pmezard/go-difflib", 272 | sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", 273 | version = "v1.0.0", 274 | ) 275 | go_repository( 276 | name = "com_github_prometheus_client_model", 277 | importpath = "github.com/prometheus/client_model", 278 | sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", 279 | version = "v0.0.0-20190812154241-14fe0d1b01d4", 280 | ) 281 | 282 | go_repository( 283 | name = "com_github_rogpeppe_go_internal", 284 | importpath = "github.com/rogpeppe/go-internal", 285 | sum = "h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=", 286 | version = "v1.3.0", 287 | ) 288 | go_repository( 289 | name = "com_github_sherclockholmes_webpush_go", 290 | importpath = "github.com/SherClockHolmes/webpush-go", 291 | sum = "h1:sGv0/ZWCvb1HUH+izLqrb2i68HuqD/0Y+AmGQfyqKJA=", 292 | version = "v1.2.0", 293 | ) 294 | go_repository( 295 | name = "com_github_spf13_afero", 296 | importpath = "github.com/spf13/afero", 297 | sum = "h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=", 298 | version = "v1.9.5", 299 | ) 300 | go_repository( 301 | name = "com_github_stretchr_objx", 302 | importpath = "github.com/stretchr/objx", 303 | sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=", 304 | version = "v0.1.0", 305 | ) 306 | go_repository( 307 | name = "com_github_stretchr_testify", 308 | importpath = "github.com/stretchr/testify", 309 | sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=", 310 | version = "v1.7.0", 311 | ) 312 | 313 | go_repository( 314 | name = "com_github_yuin_goldmark", 315 | importpath = "github.com/yuin/goldmark", 316 | sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", 317 | version = "v1.4.13", 318 | ) 319 | go_repository( 320 | name = "com_google_cloud_go", 321 | importpath = "cloud.google.com/go", 322 | sum = "h1:XgtDnVJRCPEUG21gjFiRPz4zI1Mjg16R+NYQjfmU4XY=", 323 | version = "v0.75.0", 324 | ) 325 | 326 | go_repository( 327 | name = "com_google_cloud_go_bigquery", 328 | importpath = "cloud.google.com/go/bigquery", 329 | sum = "h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA=", 330 | version = "v1.8.0", 331 | ) 332 | go_repository( 333 | name = "com_google_cloud_go_datastore", 334 | importpath = "cloud.google.com/go/datastore", 335 | sum = "h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ=", 336 | version = "v1.1.0", 337 | ) 338 | go_repository( 339 | name = "com_google_cloud_go_pubsub", 340 | importpath = "cloud.google.com/go/pubsub", 341 | sum = "h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU=", 342 | version = "v1.3.1", 343 | ) 344 | go_repository( 345 | name = "com_google_cloud_go_storage", 346 | importpath = "cloud.google.com/go/storage", 347 | sum = "h1:6RRlFMv1omScs6iq2hfE3IvgE+l6RfJPampq8UZc5TU=", 348 | version = "v1.14.0", 349 | ) 350 | go_repository( 351 | name = "com_shuralyov_dmitri_gpu_mtl", 352 | importpath = "dmitri.shuralyov.com/gpu/mtl", 353 | sum = "h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=", 354 | version = "v0.0.0-20190408044501-666a987793e9", 355 | ) 356 | go_repository( 357 | name = "in_gopkg_check_v1", 358 | importpath = "gopkg.in/check.v1", 359 | sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", 360 | version = "v1.0.0-20180628173108-788fd7840127", 361 | ) 362 | 363 | go_repository( 364 | name = "in_gopkg_errgo_v2", 365 | importpath = "gopkg.in/errgo.v2", 366 | sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=", 367 | version = "v2.1.0", 368 | ) 369 | go_repository( 370 | name = "in_gopkg_yaml_v2", 371 | importpath = "gopkg.in/yaml.v2", 372 | sum = "h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=", 373 | version = "v2.2.2", 374 | ) 375 | 376 | go_repository( 377 | name = "in_gopkg_yaml_v3", 378 | importpath = "gopkg.in/yaml.v3", 379 | sum = "h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=", 380 | version = "v3.0.0-20200313102051-9f266ea9e77c", 381 | ) 382 | go_repository( 383 | name = "io_opencensus_go", 384 | importpath = "go.opencensus.io", 385 | sum = "h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0=", 386 | version = "v0.22.5", 387 | ) 388 | go_repository( 389 | name = "io_rsc_binaryregexp", 390 | importpath = "rsc.io/binaryregexp", 391 | sum = "h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=", 392 | version = "v0.2.0", 393 | ) 394 | go_repository( 395 | name = "io_rsc_quote_v3", 396 | importpath = "rsc.io/quote/v3", 397 | sum = "h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=", 398 | version = "v3.1.0", 399 | ) 400 | go_repository( 401 | name = "io_rsc_sampler", 402 | importpath = "rsc.io/sampler", 403 | sum = "h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=", 404 | version = "v1.3.0", 405 | ) 406 | go_repository( 407 | name = "org_golang_google_api", 408 | importpath = "google.golang.org/api", 409 | sum = "h1:uWrpz12dpVPn7cojP82mk02XDgTJLDPc2KbVTxrWb4A=", 410 | version = "v0.40.0", 411 | ) 412 | go_repository( 413 | name = "org_golang_google_appengine", 414 | importpath = "google.golang.org/appengine", 415 | sum = "h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=", 416 | version = "v1.6.7", 417 | ) 418 | go_repository( 419 | name = "org_golang_google_genproto", 420 | importpath = "google.golang.org/genproto", 421 | sum = "h1:PYBmACG+YEv8uQPW0r1kJj8tR+gkF0UWq7iFdUezwEw=", 422 | version = "v0.0.0-20210226172003-ab064af71705", 423 | ) 424 | go_repository( 425 | name = "org_golang_google_grpc", 426 | build_file_proto_mode = "disable", 427 | importpath = "google.golang.org/grpc", 428 | patches = [ 429 | "//third_party:grpc-crosscompile.patch", 430 | ], 431 | sum = "h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8=", 432 | version = "v1.35.0", 433 | ) 434 | 435 | go_repository( 436 | name = "org_golang_google_protobuf", 437 | importpath = "google.golang.org/protobuf", 438 | sum = "h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=", 439 | version = "v1.25.0", 440 | ) 441 | go_repository( 442 | name = "org_golang_x_crypto", 443 | importpath = "golang.org/x/crypto", 444 | sum = "h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=", 445 | version = "v0.6.0", 446 | ) 447 | go_repository( 448 | name = "org_golang_x_exp", 449 | importpath = "golang.org/x/exp", 450 | sum = "h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=", 451 | version = "v0.0.0-20200224162631-6cc2880d07d6", 452 | ) 453 | 454 | go_repository( 455 | name = "org_golang_x_image", 456 | importpath = "golang.org/x/image", 457 | sum = "h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=", 458 | version = "v0.0.0-20190802002840-cff245a6509b", 459 | ) 460 | go_repository( 461 | name = "org_golang_x_lint", 462 | importpath = "golang.org/x/lint", 463 | sum = "h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI=", 464 | version = "v0.0.0-20201208152925-83fdc39ff7b5", 465 | ) 466 | 467 | go_repository( 468 | name = "org_golang_x_mobile", 469 | importpath = "golang.org/x/mobile", 470 | sum = "h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=", 471 | version = "v0.0.0-20190719004257-d2bd2a29d028", 472 | ) 473 | go_repository( 474 | name = "org_golang_x_mod", 475 | importpath = "golang.org/x/mod", 476 | sum = "h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=", 477 | version = "v0.6.0-dev.0.20220419223038-86c51ed26bb4", 478 | ) 479 | go_repository( 480 | name = "org_golang_x_net", 481 | importpath = "golang.org/x/net", 482 | patches = [ 483 | "//third_party:org_golang_x_net-crosscompile.patch", 484 | ], 485 | sum = "h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=", 486 | version = "v0.7.0", 487 | ) 488 | 489 | go_repository( 490 | name = "org_golang_x_oauth2", 491 | importpath = "golang.org/x/oauth2", 492 | sum = "h1:5vD4XjIc0X5+kHZjx4UecYdjA6mJo+XXNoaW0EjU5Os=", 493 | version = "v0.0.0-20210218202405-ba52d332ba99", 494 | ) 495 | go_repository( 496 | name = "org_golang_x_sync", 497 | importpath = "golang.org/x/sync", 498 | sum = "h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=", 499 | version = "v0.0.0-20220722155255-886fb9371eb4", 500 | ) 501 | go_repository( 502 | name = "org_golang_x_sys", 503 | importpath = "golang.org/x/sys", 504 | sum = "h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=", 505 | version = "v0.5.0", 506 | ) 507 | 508 | go_repository( 509 | name = "org_golang_x_term", 510 | importpath = "golang.org/x/term", 511 | sum = "h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=", 512 | version = "v0.5.0", 513 | ) 514 | go_repository( 515 | name = "org_golang_x_text", 516 | importpath = "golang.org/x/text", 517 | sum = "h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=", 518 | version = "v0.7.0", 519 | ) 520 | 521 | go_repository( 522 | name = "org_golang_x_time", 523 | importpath = "golang.org/x/time", 524 | sum = "h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=", 525 | version = "v0.0.0-20191024005414-555d28b269f0", 526 | ) 527 | go_repository( 528 | name = "org_golang_x_tools", 529 | importpath = "golang.org/x/tools", 530 | sum = "h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=", 531 | version = "v0.1.12", 532 | ) 533 | 534 | go_repository( 535 | name = "org_golang_x_xerrors", 536 | importpath = "golang.org/x/xerrors", 537 | sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=", 538 | version = "v0.0.0-20200804184101-5ec99f83aff1", 539 | ) 540 | -------------------------------------------------------------------------------- /third_party/grpc-crosscompile.patch: -------------------------------------------------------------------------------- 1 | diff -urN b/internal/channelz/BUILD.bazel c/internal/channelz/BUILD.bazel 2 | --- internal/channelz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 3 | +++ internal/channelz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 4 | @@ -17,6 +17,12 @@ 5 | "//credentials:go_default_library", 6 | "//grpclog:go_default_library", 7 | ] + select({ 8 | + "@io_bazel_rules_go//go/platform:darwin": [ 9 | + "@org_golang_x_sys//unix:go_default_library", 10 | + ], 11 | + "@io_bazel_rules_go//go/platform:windows": [ 12 | + "@org_golang_x_sys//unix:go_default_library", 13 | + ], 14 | "@io_bazel_rules_go//go/platform:android": [ 15 | "@org_golang_x_sys//unix:go_default_library", 16 | ], 17 | diff -urN a/internal/syscall/BUILD.bazel b/internal/syscall/BUILD.bazel 18 | --- internal/syscall/BUILD.bazel 19 | +++ internal/syscall/BUILD.bazel 20 | @@ -15,12 +15,15 @@ go_library( 21 | ], 22 | "@io_bazel_rules_go//go/platform:darwin": [ 23 | "//grpclog:go_default_library", 24 | + "@org_golang_x_sys//unix:go_default_library", 25 | ], 26 | "@io_bazel_rules_go//go/platform:dragonfly": [ 27 | "//grpclog:go_default_library", 28 | + "@org_golang_x_sys//unix:go_default_library", 29 | ], 30 | "@io_bazel_rules_go//go/platform:freebsd": [ 31 | "//grpclog:go_default_library", 32 | + "@org_golang_x_sys//unix:go_default_library", 33 | ], 34 | "@io_bazel_rules_go//go/platform:linux": [ 35 | "//grpclog:go_default_library", 36 | @@ -34,15 +34,18 @@ go_library( 37 | ], 38 | "@io_bazel_rules_go//go/platform:netbsd": [ 39 | "//grpclog:go_default_library", 40 | + "@org_golang_x_sys//unix:go_default_library", 41 | ], 42 | "@io_bazel_rules_go//go/platform:openbsd": [ 43 | "//grpclog:go_default_library", 44 | + "@org_golang_x_sys//unix:go_default_library", 45 | ], 46 | "@io_bazel_rules_go//go/platform:plan9": [ 47 | "//grpclog:go_default_library", 48 | ], 49 | "@io_bazel_rules_go//go/platform:solaris": [ 50 | "//grpclog:go_default_library", 51 | + "@org_golang_x_sys//unix:go_default_library", 52 | ], 53 | "@io_bazel_rules_go//go/platform:windows": [ 54 | "//grpclog:go_default_library", 55 | -------------------------------------------------------------------------------- /third_party/org_golang_x_net-crosscompile.patch: -------------------------------------------------------------------------------- 1 | diff -ruN a/ipv4/BUILD.bazel b/ipv4/BUILD.bazel 2 | --- ipv4/BUILD.bazel 2020-02-23 20:59:17.000000000 -0800 3 | +++ ipv4/BUILD.bazel 2020-02-23 21:00:29.000000000 -0800 4 | @@ -71,15 +71,8 @@ 5 | "//bpf:go_default_library", 6 | "//internal/iana:go_default_library", 7 | "//internal/socket:go_default_library", 8 | - ] + select({ 9 | - "@io_bazel_rules_go//go/platform:android": [ 10 | - "@org_golang_x_sys//unix:go_default_library", 11 | - ], 12 | - "@io_bazel_rules_go//go/platform:linux": [ 13 | - "@org_golang_x_sys//unix:go_default_library", 14 | - ], 15 | - "//conditions:default": [], 16 | - }), 17 | + "@org_golang_x_sys//unix:go_default_library", 18 | + ], 19 | ) 20 | 21 | go_test( 22 | diff -ruN a/ipv6/BUILD.bazel b/ipv6/BUILD.bazel 23 | --- ipv6/BUILD.bazel 2020-02-23 20:59:29.000000000 -0800 24 | +++ ipv6/BUILD.bazel 2020-02-23 21:00:53.000000000 -0800 25 | @@ -70,15 +70,8 @@ 26 | "//bpf:go_default_library", 27 | "//internal/iana:go_default_library", 28 | "//internal/socket:go_default_library", 29 | - ] + select({ 30 | - "@io_bazel_rules_go//go/platform:android": [ 31 | - "@org_golang_x_sys//unix:go_default_library", 32 | - ], 33 | - "@io_bazel_rules_go//go/platform:linux": [ 34 | - "@org_golang_x_sys//unix:go_default_library", 35 | - ], 36 | - "//conditions:default": [], 37 | - }), 38 | + "@org_golang_x_sys//unix:go_default_library", 39 | + ], 40 | ) 41 | 42 | go_test( 43 | -------------------------------------------------------------------------------- /third_party/proto.patch: -------------------------------------------------------------------------------- 1 | diff -urN a/descriptor/BUILD.bazel b/descriptor/BUILD.bazel 2 | --- a/descriptor/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 3 | +++ b/descriptor/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 4 | @@ -0,0 +1,22 @@ 5 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 6 | + 7 | +go_library( 8 | + name = "go_default_library", 9 | + srcs = ["descriptor.go"], 10 | + importpath = "github.com/golang/protobuf/descriptor", 11 | + visibility = ["//visibility:public"], 12 | + deps = [ 13 | + "//proto:go_default_library", 14 | + "//protoc-gen-go/descriptor:go_default_library", 15 | + ], 16 | +) 17 | + 18 | +go_test( 19 | + name = "go_default_test", 20 | + srcs = ["descriptor_test.go"], 21 | + embed = [":go_default_library"], 22 | + deps = [ 23 | + "//proto/test_proto:go_default_library", 24 | + "//protoc-gen-go/descriptor:go_default_library", 25 | + ], 26 | +) 27 | diff -urN a/jsonpb/BUILD.bazel b/jsonpb/BUILD.bazel 28 | --- a/jsonpb/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 29 | +++ b/jsonpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 30 | @@ -0,0 +1,29 @@ 31 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 32 | + 33 | +go_library( 34 | + name = "go_default_library", 35 | + srcs = ["jsonpb.go"], 36 | + importpath = "github.com/golang/protobuf/jsonpb", 37 | + visibility = ["//visibility:public"], 38 | + deps = [ 39 | + "//proto:go_default_library", 40 | + "//ptypes/struct:go_default_library", 41 | + ], 42 | +) 43 | + 44 | +go_test( 45 | + name = "go_default_test", 46 | + srcs = ["jsonpb_test.go"], 47 | + embed = [":go_default_library"], 48 | + deps = [ 49 | + "//jsonpb/jsonpb_test_proto:go_default_library", 50 | + "//proto:go_default_library", 51 | + "//proto/proto3_proto:go_default_library", 52 | + "//ptypes:go_default_library", 53 | + "//ptypes/any:go_default_library", 54 | + "//ptypes/duration:go_default_library", 55 | + "//ptypes/struct:go_default_library", 56 | + "//ptypes/timestamp:go_default_library", 57 | + "//ptypes/wrappers:go_default_library", 58 | + ], 59 | +) 60 | diff -urN a/jsonpb/jsonpb_test_proto/BUILD.bazel b/jsonpb/jsonpb_test_proto/BUILD.bazel 61 | --- a/jsonpb/jsonpb_test_proto/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 62 | +++ b/jsonpb/jsonpb_test_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 63 | @@ -0,0 +1,19 @@ 64 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 65 | + 66 | +go_library( 67 | + name = "go_default_library", 68 | + srcs = [ 69 | + "more_test_objects.pb.go", 70 | + "test_objects.pb.go", 71 | + ], 72 | + importpath = "github.com/golang/protobuf/jsonpb/jsonpb_test_proto", 73 | + visibility = ["//visibility:public"], 74 | + deps = [ 75 | + "//proto:go_default_library", 76 | + "//ptypes/any:go_default_library", 77 | + "//ptypes/duration:go_default_library", 78 | + "//ptypes/struct:go_default_library", 79 | + "//ptypes/timestamp:go_default_library", 80 | + "//ptypes/wrappers:go_default_library", 81 | + ], 82 | +) 83 | diff -urN a/proto/BUILD.bazel b/proto/BUILD.bazel 84 | --- a/proto/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 85 | +++ b/proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 86 | @@ -0,0 +1,54 @@ 87 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 88 | + 89 | +go_library( 90 | + name = "go_default_library", 91 | + srcs = [ 92 | + "clone.go", 93 | + "decode.go", 94 | + "deprecated.go", 95 | + "discard.go", 96 | + "encode.go", 97 | + "equal.go", 98 | + "extensions.go", 99 | + "lib.go", 100 | + "message_set.go", 101 | + "pointer_unsafe.go", 102 | + "pointer_reflect.go", 103 | + "properties.go", 104 | + "table_marshal.go", 105 | + "table_merge.go", 106 | + "table_unmarshal.go", 107 | + "text.go", 108 | + "text_parser.go", 109 | + ], 110 | + importpath = "github.com/golang/protobuf/proto", 111 | + visibility = ["//visibility:public"], 112 | +) 113 | + 114 | +go_test( 115 | + name = "go_default_test", 116 | + srcs = [ 117 | + "all_test.go", 118 | + "any_test.go", 119 | + "clone_test.go", 120 | + "decode_test.go", 121 | + "discard_test.go", 122 | + "encode_test.go", 123 | + "equal_test.go", 124 | + "extensions_test.go", 125 | + "map_test.go", 126 | + "message_set_test.go", 127 | + "proto3_test.go", 128 | + "size2_test.go", 129 | + "size_test.go", 130 | + "text_parser_test.go", 131 | + "text_test.go", 132 | + ], 133 | + embed = [":go_default_library"], 134 | + deps = [ 135 | + "//proto/proto3_proto:go_default_library", 136 | + "//proto/test_proto:go_default_library", 137 | + "//ptypes:go_default_library", 138 | + "//ptypes/any:go_default_library", 139 | + ], 140 | +) 141 | diff -urN a/proto/proto3_proto/BUILD.bazel b/proto/proto3_proto/BUILD.bazel 142 | --- a/proto/proto3_proto/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 143 | +++ b/proto/proto3_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 144 | @@ -0,0 +1,13 @@ 145 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 146 | + 147 | +go_library( 148 | + name = "go_default_library", 149 | + srcs = ["proto3.pb.go"], 150 | + importpath = "github.com/golang/protobuf/proto/proto3_proto", 151 | + visibility = ["//visibility:public"], 152 | + deps = [ 153 | + "//proto:go_default_library", 154 | + "//proto/test_proto:go_default_library", 155 | + "//ptypes/any:go_default_library", 156 | + ], 157 | +) 158 | diff -urN a/proto/test_proto/BUILD.bazel b/proto/test_proto/BUILD.bazel 159 | --- a/proto/test_proto/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 160 | +++ b/proto/test_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 161 | @@ -0,0 +1,9 @@ 162 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 163 | + 164 | +go_library( 165 | + name = "go_default_library", 166 | + srcs = ["test.pb.go"], 167 | + importpath = "github.com/golang/protobuf/proto/test_proto", 168 | + visibility = ["//visibility:public"], 169 | + deps = ["//proto:go_default_library"], 170 | +) 171 | diff -urN a/protoc-gen-go/BUILD.bazel b/protoc-gen-go/BUILD.bazel 172 | --- a/protoc-gen-go/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 173 | +++ b/protoc-gen-go/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 174 | @@ -0,0 +1,28 @@ 175 | +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") 176 | + 177 | +go_library( 178 | + name = "go_default_library", 179 | + srcs = [ 180 | + "link_grpc.go", 181 | + "main.go", 182 | + ], 183 | + importpath = "github.com/golang/protobuf/protoc-gen-go", 184 | + visibility = ["//visibility:private"], 185 | + deps = [ 186 | + "//proto:go_default_library", 187 | + "//protoc-gen-go/generator:go_default_library", 188 | + "//protoc-gen-go/grpc:go_default_library", 189 | + ], 190 | +) 191 | + 192 | +go_binary( 193 | + name = "protoc-gen-go", 194 | + embed = [":go_default_library"], 195 | + visibility = ["//visibility:public"], 196 | +) 197 | + 198 | +go_test( 199 | + name = "go_default_test", 200 | + srcs = ["golden_test.go"], 201 | + embed = [":go_default_library"], 202 | +) 203 | diff -urN a/protoc-gen-go/descriptor/BUILD.bazel b/protoc-gen-go/descriptor/BUILD.bazel 204 | --- a/protoc-gen-go/descriptor/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 205 | +++ b/protoc-gen-go/descriptor/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 206 | @@ -0,0 +1,9 @@ 207 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 208 | + 209 | +go_library( 210 | + name = "go_default_library", 211 | + srcs = ["descriptor.pb.go"], 212 | + importpath = "github.com/golang/protobuf/protoc-gen-go/descriptor", 213 | + visibility = ["//visibility:public"], 214 | + deps = ["//proto:go_default_library"], 215 | +) 216 | diff -urN a/protoc-gen-go/generator/BUILD.bazel b/protoc-gen-go/generator/BUILD.bazel 217 | --- a/protoc-gen-go/generator/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 218 | +++ b/protoc-gen-go/generator/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 219 | @@ -0,0 +1,21 @@ 220 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 221 | + 222 | +go_library( 223 | + name = "go_default_library", 224 | + srcs = ["generator.go"], 225 | + importpath = "github.com/golang/protobuf/protoc-gen-go/generator", 226 | + visibility = ["//visibility:public"], 227 | + deps = [ 228 | + "//proto:go_default_library", 229 | + "//protoc-gen-go/descriptor:go_default_library", 230 | + "//protoc-gen-go/generator/internal/remap:go_default_library", 231 | + "//protoc-gen-go/plugin:go_default_library", 232 | + ], 233 | +) 234 | + 235 | +go_test( 236 | + name = "go_default_test", 237 | + srcs = ["name_test.go"], 238 | + embed = [":go_default_library"], 239 | + deps = ["//protoc-gen-go/descriptor:go_default_library"], 240 | +) 241 | diff -urN a/protoc-gen-go/generator/internal/remap/BUILD.bazel b/protoc-gen-go/generator/internal/remap/BUILD.bazel 242 | --- a/protoc-gen-go/generator/internal/remap/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 243 | +++ b/protoc-gen-go/generator/internal/remap/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 244 | @@ -0,0 +1,14 @@ 245 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 246 | + 247 | +go_library( 248 | + name = "go_default_library", 249 | + srcs = ["remap.go"], 250 | + importpath = "github.com/golang/protobuf/protoc-gen-go/generator/internal/remap", 251 | + visibility = ["//protoc-gen-go/generator:__subpackages__"], 252 | +) 253 | + 254 | +go_test( 255 | + name = "go_default_test", 256 | + srcs = ["remap_test.go"], 257 | + embed = [":go_default_library"], 258 | +) 259 | diff -urN a/protoc-gen-go/grpc/BUILD.bazel b/protoc-gen-go/grpc/BUILD.bazel 260 | --- a/protoc-gen-go/grpc/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 261 | +++ b/protoc-gen-go/grpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 262 | @@ -0,0 +1,12 @@ 263 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 264 | + 265 | +go_library( 266 | + name = "go_default_library", 267 | + srcs = ["grpc.go"], 268 | + importpath = "github.com/golang/protobuf/protoc-gen-go/grpc", 269 | + visibility = ["//visibility:public"], 270 | + deps = [ 271 | + "//protoc-gen-go/descriptor:go_default_library", 272 | + "//protoc-gen-go/generator:go_default_library", 273 | + ], 274 | +) 275 | diff -urN a/protoc-gen-go/plugin/BUILD.bazel b/protoc-gen-go/plugin/BUILD.bazel 276 | --- a/protoc-gen-go/plugin/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 277 | +++ b/protoc-gen-go/plugin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 278 | @@ -0,0 +1,12 @@ 279 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 280 | + 281 | +go_library( 282 | + name = "go_default_library", 283 | + srcs = ["plugin.pb.go"], 284 | + importpath = "github.com/golang/protobuf/protoc-gen-go/plugin", 285 | + visibility = ["//visibility:public"], 286 | + deps = [ 287 | + "//proto:go_default_library", 288 | + "//protoc-gen-go/descriptor:go_default_library", 289 | + ], 290 | +) 291 | diff -urN a/protoc-gen-go/testdata/BUILD.bazel b/protoc-gen-go/testdata/BUILD.bazel 292 | --- a/protoc-gen-go/testdata/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 293 | +++ b/protoc-gen-go/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 294 | @@ -0,0 +1,20 @@ 295 | +load("@io_bazel_rules_go//go:def.bzl", "go_test") 296 | + 297 | +go_test( 298 | + name = "go_default_test", 299 | + srcs = [ 300 | + "extension_test.go", 301 | + "import_public_test.go", 302 | + "main_test.go", 303 | + ], 304 | + deps = [ 305 | + "//proto:go_default_library", 306 | + "//protoc-gen-go/testdata/extension_base:go_default_library", 307 | + "//protoc-gen-go/testdata/extension_user:go_default_library", 308 | + "//protoc-gen-go/testdata/import_public:go_default_library", 309 | + "//protoc-gen-go/testdata/import_public/sub:go_default_library", 310 | + "//protoc-gen-go/testdata/imports:go_default_library", 311 | + "//protoc-gen-go/testdata/multi:go_default_library", 312 | + "//protoc-gen-go/testdata/my_test:go_default_library", 313 | + ], 314 | +) 315 | diff -urN a/protoc-gen-go/testdata/deprecated/BUILD.bazel b/protoc-gen-go/testdata/deprecated/BUILD.bazel 316 | --- a/protoc-gen-go/testdata/deprecated/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 317 | +++ b/protoc-gen-go/testdata/deprecated/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 318 | @@ -0,0 +1,14 @@ 319 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 320 | + 321 | +go_library( 322 | + name = "go_default_library", 323 | + srcs = ["deprecated.pb.go"], 324 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/deprecated", 325 | + visibility = ["//visibility:public"], 326 | + deps = [ 327 | + "//proto:go_default_library", 328 | + "@org_golang_google_grpc//:go_default_library", 329 | + "@org_golang_google_grpc//codes:go_default_library", 330 | + "@org_golang_google_grpc//status:go_default_library", 331 | + ], 332 | +) 333 | diff -urN a/protoc-gen-go/testdata/extension_base/BUILD.bazel b/protoc-gen-go/testdata/extension_base/BUILD.bazel 334 | --- a/protoc-gen-go/testdata/extension_base/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 335 | +++ b/protoc-gen-go/testdata/extension_base/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 336 | @@ -0,0 +1,9 @@ 337 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 338 | + 339 | +go_library( 340 | + name = "go_default_library", 341 | + srcs = ["extension_base.pb.go"], 342 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_base", 343 | + visibility = ["//visibility:public"], 344 | + deps = ["//proto:go_default_library"], 345 | +) 346 | diff -urN a/protoc-gen-go/testdata/extension_extra/BUILD.bazel b/protoc-gen-go/testdata/extension_extra/BUILD.bazel 347 | --- a/protoc-gen-go/testdata/extension_extra/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 348 | +++ b/protoc-gen-go/testdata/extension_extra/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 349 | @@ -0,0 +1,9 @@ 350 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 351 | + 352 | +go_library( 353 | + name = "go_default_library", 354 | + srcs = ["extension_extra.pb.go"], 355 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra", 356 | + visibility = ["//visibility:public"], 357 | + deps = ["//proto:go_default_library"], 358 | +) 359 | diff -urN a/protoc-gen-go/testdata/extension_user/BUILD.bazel b/protoc-gen-go/testdata/extension_user/BUILD.bazel 360 | --- a/protoc-gen-go/testdata/extension_user/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 361 | +++ b/protoc-gen-go/testdata/extension_user/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 362 | @@ -0,0 +1,13 @@ 363 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 364 | + 365 | +go_library( 366 | + name = "go_default_library", 367 | + srcs = ["extension_user.pb.go"], 368 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/extension_user", 369 | + visibility = ["//visibility:public"], 370 | + deps = [ 371 | + "//proto:go_default_library", 372 | + "//protoc-gen-go/testdata/extension_base:go_default_library", 373 | + "//protoc-gen-go/testdata/extension_extra:go_default_library", 374 | + ], 375 | +) 376 | diff -urN a/protoc-gen-go/testdata/grpc/BUILD.bazel b/protoc-gen-go/testdata/grpc/BUILD.bazel 377 | --- a/protoc-gen-go/testdata/grpc/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 378 | +++ b/protoc-gen-go/testdata/grpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 379 | @@ -0,0 +1,17 @@ 380 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 381 | + 382 | +go_library( 383 | + name = "go_default_library", 384 | + srcs = [ 385 | + "grpc.pb.go", 386 | + "grpc_empty.pb.go", 387 | + ], 388 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/grpc", 389 | + visibility = ["//visibility:public"], 390 | + deps = [ 391 | + "//proto:go_default_library", 392 | + "@org_golang_google_grpc//:go_default_library", 393 | + "@org_golang_google_grpc//codes:go_default_library", 394 | + "@org_golang_google_grpc//status:go_default_library", 395 | + ], 396 | +) 397 | diff -urN a/protoc-gen-go/testdata/import_public/BUILD.bazel b/protoc-gen-go/testdata/import_public/BUILD.bazel 398 | --- a/protoc-gen-go/testdata/import_public/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 399 | +++ b/protoc-gen-go/testdata/import_public/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 400 | @@ -0,0 +1,15 @@ 401 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 402 | + 403 | +go_library( 404 | + name = "go_default_library", 405 | + srcs = [ 406 | + "a.pb.go", 407 | + "b.pb.go", 408 | + ], 409 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public", 410 | + visibility = ["//visibility:public"], 411 | + deps = [ 412 | + "//proto:go_default_library", 413 | + "//protoc-gen-go/testdata/import_public/sub:go_default_library", 414 | + ], 415 | +) 416 | diff -urN a/protoc-gen-go/testdata/import_public/importing/BUILD.bazel b/protoc-gen-go/testdata/import_public/importing/BUILD.bazel 417 | --- a/protoc-gen-go/testdata/import_public/importing/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 418 | +++ b/protoc-gen-go/testdata/import_public/importing/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 419 | @@ -0,0 +1,13 @@ 420 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 421 | + 422 | +go_library( 423 | + name = "go_default_library", 424 | + srcs = ["importing.pb.go"], 425 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/importing", 426 | + visibility = ["//visibility:public"], 427 | + deps = [ 428 | + "//proto:go_default_library", 429 | + "//protoc-gen-go/testdata/import_public:go_default_library", 430 | + "//protoc-gen-go/testdata/import_public/sub:go_default_library", 431 | + ], 432 | +) 433 | diff -urN a/protoc-gen-go/testdata/import_public/sub/BUILD.bazel b/protoc-gen-go/testdata/import_public/sub/BUILD.bazel 434 | --- a/protoc-gen-go/testdata/import_public/sub/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 435 | +++ b/protoc-gen-go/testdata/import_public/sub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 436 | @@ -0,0 +1,12 @@ 437 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 438 | + 439 | +go_library( 440 | + name = "go_default_library", 441 | + srcs = [ 442 | + "a.pb.go", 443 | + "b.pb.go", 444 | + ], 445 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub", 446 | + visibility = ["//visibility:public"], 447 | + deps = ["//proto:go_default_library"], 448 | +) 449 | diff -urN a/protoc-gen-go/testdata/imports/BUILD.bazel b/protoc-gen-go/testdata/imports/BUILD.bazel 450 | --- a/protoc-gen-go/testdata/imports/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 451 | +++ b/protoc-gen-go/testdata/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 452 | @@ -0,0 +1,19 @@ 453 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 454 | + 455 | +go_library( 456 | + name = "go_default_library", 457 | + srcs = [ 458 | + "test_import_a1m1.pb.go", 459 | + "test_import_a1m2.pb.go", 460 | + "test_import_all.pb.go", 461 | + ], 462 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/imports", 463 | + visibility = ["//visibility:public"], 464 | + deps = [ 465 | + "//proto:go_default_library", 466 | + "//protoc-gen-go/testdata/imports/fmt:go_default_library", 467 | + "//protoc-gen-go/testdata/imports/test_a_1:go_default_library", 468 | + "//protoc-gen-go/testdata/imports/test_a_2:go_default_library", 469 | + "//protoc-gen-go/testdata/imports/test_b_1:go_default_library", 470 | + ], 471 | +) 472 | diff -urN a/protoc-gen-go/testdata/imports/fmt/BUILD.bazel b/protoc-gen-go/testdata/imports/fmt/BUILD.bazel 473 | --- a/protoc-gen-go/testdata/imports/fmt/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 474 | +++ b/protoc-gen-go/testdata/imports/fmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 475 | @@ -0,0 +1,9 @@ 476 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 477 | + 478 | +go_library( 479 | + name = "go_default_library", 480 | + srcs = ["m.pb.go"], 481 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/fmt", 482 | + visibility = ["//visibility:public"], 483 | + deps = ["//proto:go_default_library"], 484 | +) 485 | diff -urN a/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel b/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel 486 | --- a/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 487 | +++ b/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 488 | @@ -0,0 +1,12 @@ 489 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 490 | + 491 | +go_library( 492 | + name = "go_default_library", 493 | + srcs = [ 494 | + "m1.pb.go", 495 | + "m2.pb.go", 496 | + ], 497 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1", 498 | + visibility = ["//visibility:public"], 499 | + deps = ["//proto:go_default_library"], 500 | +) 501 | diff -urN a/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel b/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel 502 | --- a/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 503 | +++ b/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 504 | @@ -0,0 +1,12 @@ 505 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 506 | + 507 | +go_library( 508 | + name = "go_default_library", 509 | + srcs = [ 510 | + "m3.pb.go", 511 | + "m4.pb.go", 512 | + ], 513 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_2", 514 | + visibility = ["//visibility:public"], 515 | + deps = ["//proto:go_default_library"], 516 | +) 517 | diff -urN a/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel b/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel 518 | --- a/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 519 | +++ b/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 520 | @@ -0,0 +1,12 @@ 521 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 522 | + 523 | +go_library( 524 | + name = "go_default_library", 525 | + srcs = [ 526 | + "m1.pb.go", 527 | + "m2.pb.go", 528 | + ], 529 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_b_1", 530 | + visibility = ["//visibility:public"], 531 | + deps = ["//proto:go_default_library"], 532 | +) 533 | diff -urN a/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel b/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel 534 | --- a/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 535 | +++ b/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 536 | @@ -0,0 +1,9 @@ 537 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 538 | + 539 | +go_library( 540 | + name = "go_default_library", 541 | + srcs = ["test.pb.go"], 542 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/issue780_oneof_conflict", 543 | + visibility = ["//visibility:public"], 544 | + deps = ["//proto:go_default_library"], 545 | +) 546 | diff -urN a/protoc-gen-go/testdata/multi/BUILD.bazel b/protoc-gen-go/testdata/multi/BUILD.bazel 547 | --- a/protoc-gen-go/testdata/multi/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 548 | +++ b/protoc-gen-go/testdata/multi/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 549 | @@ -0,0 +1,13 @@ 550 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 551 | + 552 | +go_library( 553 | + name = "go_default_library", 554 | + srcs = [ 555 | + "multi1.pb.go", 556 | + "multi2.pb.go", 557 | + "multi3.pb.go", 558 | + ], 559 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/multi", 560 | + visibility = ["//visibility:public"], 561 | + deps = ["//proto:go_default_library"], 562 | +) 563 | diff -urN a/protoc-gen-go/testdata/my_test/BUILD.bazel b/protoc-gen-go/testdata/my_test/BUILD.bazel 564 | --- a/protoc-gen-go/testdata/my_test/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 565 | +++ b/protoc-gen-go/testdata/my_test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 566 | @@ -0,0 +1,12 @@ 567 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 568 | + 569 | +go_library( 570 | + name = "go_default_library", 571 | + srcs = ["test.pb.go"], 572 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/my_test", 573 | + visibility = ["//visibility:public"], 574 | + deps = [ 575 | + "//proto:go_default_library", 576 | + "//protoc-gen-go/testdata/multi:go_default_library", 577 | + ], 578 | +) 579 | diff -urN a/protoc-gen-go/testdata/proto3/BUILD.bazel b/protoc-gen-go/testdata/proto3/BUILD.bazel 580 | --- a/protoc-gen-go/testdata/proto3/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 581 | +++ b/protoc-gen-go/testdata/proto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 582 | @@ -0,0 +1,9 @@ 583 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 584 | + 585 | +go_library( 586 | + name = "go_default_library", 587 | + srcs = ["proto3.pb.go"], 588 | + importpath = "github.com/golang/protobuf/protoc-gen-go/testdata/proto3", 589 | + visibility = ["//visibility:public"], 590 | + deps = ["//proto:go_default_library"], 591 | +) 592 | diff -urN a/ptypes/BUILD.bazel b/ptypes/BUILD.bazel 593 | --- a/ptypes/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 594 | +++ b/ptypes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 595 | @@ -0,0 +1,36 @@ 596 | +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 597 | + 598 | +go_library( 599 | + name = "go_default_library", 600 | + srcs = [ 601 | + "any.go", 602 | + "doc.go", 603 | + "duration.go", 604 | + "timestamp.go", 605 | + ], 606 | + importpath = "github.com/golang/protobuf/ptypes", 607 | + visibility = ["//visibility:public"], 608 | + deps = [ 609 | + "//proto:go_default_library", 610 | + "//ptypes/any:go_default_library", 611 | + "//ptypes/duration:go_default_library", 612 | + "//ptypes/timestamp:go_default_library", 613 | + ], 614 | +) 615 | + 616 | +go_test( 617 | + name = "go_default_test", 618 | + srcs = [ 619 | + "any_test.go", 620 | + "duration_test.go", 621 | + "timestamp_test.go", 622 | + ], 623 | + embed = [":go_default_library"], 624 | + deps = [ 625 | + "//proto:go_default_library", 626 | + "//protoc-gen-go/descriptor:go_default_library", 627 | + "//ptypes/any:go_default_library", 628 | + "//ptypes/duration:go_default_library", 629 | + "//ptypes/timestamp:go_default_library", 630 | + ], 631 | +) 632 | diff -urN a/ptypes/any/BUILD.bazel b/ptypes/any/BUILD.bazel 633 | --- a/ptypes/any/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 634 | +++ b/ptypes/any/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 635 | @@ -0,0 +1,9 @@ 636 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 637 | + 638 | +go_library( 639 | + name = "go_default_library", 640 | + srcs = ["any.pb.go"], 641 | + importpath = "github.com/golang/protobuf/ptypes/any", 642 | + visibility = ["//visibility:public"], 643 | + deps = ["//proto:go_default_library"], 644 | +) 645 | diff -urN a/ptypes/duration/BUILD.bazel b/ptypes/duration/BUILD.bazel 646 | --- a/ptypes/duration/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 647 | +++ b/ptypes/duration/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 648 | @@ -0,0 +1,9 @@ 649 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 650 | + 651 | +go_library( 652 | + name = "go_default_library", 653 | + srcs = ["duration.pb.go"], 654 | + importpath = "github.com/golang/protobuf/ptypes/duration", 655 | + visibility = ["//visibility:public"], 656 | + deps = ["//proto:go_default_library"], 657 | +) 658 | diff -urN a/ptypes/empty/BUILD.bazel b/ptypes/empty/BUILD.bazel 659 | --- a/ptypes/empty/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 660 | +++ b/ptypes/empty/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 661 | @@ -0,0 +1,9 @@ 662 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 663 | + 664 | +go_library( 665 | + name = "go_default_library", 666 | + srcs = ["empty.pb.go"], 667 | + importpath = "github.com/golang/protobuf/ptypes/empty", 668 | + visibility = ["//visibility:public"], 669 | + deps = ["//proto:go_default_library"], 670 | +) 671 | diff -urN a/ptypes/struct/BUILD.bazel b/ptypes/struct/BUILD.bazel 672 | --- a/ptypes/struct/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 673 | +++ b/ptypes/struct/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 674 | @@ -0,0 +1,9 @@ 675 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 676 | + 677 | +go_library( 678 | + name = "go_default_library", 679 | + srcs = ["struct.pb.go"], 680 | + importpath = "github.com/golang/protobuf/ptypes/struct", 681 | + visibility = ["//visibility:public"], 682 | + deps = ["//proto:go_default_library"], 683 | +) 684 | diff -urN a/ptypes/timestamp/BUILD.bazel b/ptypes/timestamp/BUILD.bazel 685 | --- a/ptypes/timestamp/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 686 | +++ b/ptypes/timestamp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 687 | @@ -0,0 +1,9 @@ 688 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 689 | + 690 | +go_library( 691 | + name = "go_default_library", 692 | + srcs = ["timestamp.pb.go"], 693 | + importpath = "github.com/golang/protobuf/ptypes/timestamp", 694 | + visibility = ["//visibility:public"], 695 | + deps = ["//proto:go_default_library"], 696 | +) 697 | diff -urN a/ptypes/wrappers/BUILD.bazel b/ptypes/wrappers/BUILD.bazel 698 | --- a/ptypes/wrappers/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500 699 | +++ b/ptypes/wrappers/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000 700 | @@ -0,0 +1,9 @@ 701 | +load("@io_bazel_rules_go//go:def.bzl", "go_library") 702 | + 703 | +go_library( 704 | + name = "go_default_library", 705 | + srcs = ["wrappers.pb.go"], 706 | + importpath = "github.com/golang/protobuf/ptypes/wrappers", 707 | + visibility = ["//visibility:public"], 708 | + deps = ["//proto:go_default_library"], 709 | +) 710 | -------------------------------------------------------------------------------- /third_party/update_go_mods: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=third_party/go_repositories.bzl%go_repositories 3 | -------------------------------------------------------------------------------- /tools/BUILD.bazel: -------------------------------------------------------------------------------- 1 | package(default_visibility = ["//visibility:public"]) 2 | 3 | load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") 4 | 5 | go_proto_compiler( 6 | name = "go_server", 7 | import_path_option = True, 8 | options = ["plugins=server"], 9 | plugin = "//tools/protoc-gen-server", 10 | suffix = ".pb.server.go", 11 | visibility = ["//visibility:public"], 12 | deps = [], 13 | ) 14 | 15 | go_proto_compiler( 16 | name = "go_client", 17 | import_path_option = True, 18 | options = ["plugins=client"], 19 | plugin = "//tools/protoc-gen-client", 20 | suffix = ".pb.client.go", 21 | visibility = ["//visibility:public"], 22 | deps = [], 23 | ) 24 | -------------------------------------------------------------------------------- /tools/protoc-gen-client/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | 3 | go_library( 4 | name = "go_default_library", 5 | srcs = ["main.go"], 6 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/tools/protoc-gen-client", 7 | visibility = ["//visibility:private"], 8 | deps = [ 9 | "@com_github_lyft_protoc_gen_star//:go_default_library", 10 | "@com_github_lyft_protoc_gen_star//lang/go:go_default_library", 11 | ], 12 | ) 13 | 14 | go_binary( 15 | name = "protoc-gen-client", 16 | embed = [":go_default_library"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | -------------------------------------------------------------------------------- /tools/protoc-gen-client/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "text/template" 6 | 7 | pgs "github.com/lyft/protoc-gen-star" 8 | pgsgo "github.com/lyft/protoc-gen-star/lang/go" 9 | ) 10 | 11 | type protoModule struct { 12 | *pgs.ModuleBase 13 | ctx pgsgo.Context 14 | tpl *template.Template 15 | } 16 | 17 | func (m *protoModule) Name() string { return "client" } 18 | 19 | func (m *protoModule) InitContext(c pgs.BuildContext) { 20 | m.ModuleBase.InitContext(c) 21 | m.ctx = pgsgo.InitContext(c.Parameters()) 22 | 23 | tpl := template.New("client") 24 | m.tpl = template.Must(tpl.Parse(serviceTpl)) 25 | } 26 | 27 | func (m *protoModule) Execute(targets map[string]pgs.File, pkgs map[string]pgs.Package) []pgs.Artifact { 28 | for _, f := range targets { 29 | if len(f.Services()) == 0 { 30 | continue 31 | } 32 | 33 | name := m.ctx.OutputPath(f).SetExt(".client.go") 34 | m.AddGeneratorTemplateFile(name.String(), m.tpl, f) 35 | } 36 | 37 | return m.Artifacts() 38 | } 39 | 40 | func main() { 41 | log.SetFlags(0) 42 | pgs.Init( 43 | pgs.DebugEnv("DEBUG"), 44 | ).RegisterModule( 45 | &protoModule{ModuleBase: &pgs.ModuleBase{}}, 46 | ).RegisterPostProcessor( 47 | pgsgo.GoFmt(), 48 | ).Render() 49 | } 50 | 51 | const serviceTpl = `package {{ .Package.ProtoName }} 52 | 53 | import ( 54 | "encoding/json" 55 | "net/http" 56 | "io/ioutil" 57 | "strings" 58 | ) 59 | 60 | {{ range .Services }} 61 | {{ range .Methods}} 62 | 63 | func Call{{ .Service.Name }}{{ .Name }}(input {{ .Input.Name }}) (*{{ .Output.Name }}, error) { 64 | {{ $method := printf "/%s.%s/%s" .Service.Package.ProtoName .Service.Name .Name }} 65 | 66 | str, err := json.Marshal(input) 67 | if err != nil { 68 | return nil, err 69 | } 70 | 71 | req, err := http.NewRequest("POST", "{{ $method }}", strings.NewReader(string(str))) 72 | if err != nil { 73 | return nil, err 74 | } 75 | 76 | req.Header.Add("Content-Type", "application/json") 77 | 78 | client := &http.Client{} 79 | resp, err := client.Do(req) 80 | if err != nil { 81 | return nil, err 82 | } 83 | 84 | defer resp.Body.Close() 85 | 86 | body, err := ioutil.ReadAll(resp.Body) 87 | if err != nil { 88 | return nil, err 89 | } 90 | 91 | instances := {{ .Output.Name }}{} 92 | err = json.Unmarshal(body, &instances) 93 | if err != nil { 94 | return nil, err 95 | } 96 | 97 | return &instances, nil 98 | } 99 | {{ end }} 100 | {{ end }} 101 | ` 102 | -------------------------------------------------------------------------------- /tools/protoc-gen-server/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | 3 | go_library( 4 | name = "go_default_library", 5 | srcs = ["main.go"], 6 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/tools/protoc-gen-server", 7 | visibility = ["//visibility:private"], 8 | deps = [ 9 | "@com_github_lyft_protoc_gen_star//:go_default_library", 10 | "@com_github_lyft_protoc_gen_star//lang/go:go_default_library", 11 | ], 12 | ) 13 | 14 | go_binary( 15 | name = "protoc-gen-server", 16 | embed = [":go_default_library"], 17 | visibility = ["//visibility:public"], 18 | ) 19 | -------------------------------------------------------------------------------- /tools/protoc-gen-server/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | pgs "github.com/lyft/protoc-gen-star" 5 | pgsgo "github.com/lyft/protoc-gen-star/lang/go" 6 | "log" 7 | "text/template" 8 | ) 9 | 10 | // main setup and render the generated code 11 | func main() { 12 | log.SetFlags(0) 13 | pgs.Init( 14 | pgs.DebugEnv("DEBUG"), 15 | ).RegisterModule( 16 | &protoModule{ModuleBase: &pgs.ModuleBase{}}, 17 | ).RegisterPostProcessor( 18 | pgsgo.GoFmt(), 19 | ).Render() 20 | } 21 | 22 | // protoModule is the struct used to generate the code 23 | type protoModule struct { 24 | *pgs.ModuleBase 25 | ctx pgsgo.Context 26 | tpl *template.Template 27 | } 28 | 29 | func (m *protoModule) Name() string { return "server" } 30 | 31 | func (m *protoModule) InitContext(c pgs.BuildContext) { 32 | m.ModuleBase.InitContext(c) 33 | m.ctx = pgsgo.InitContext(c.Parameters()) 34 | tpl := template.New("server") 35 | m.tpl = template.Must(tpl.Parse(serviceTpl)) 36 | } 37 | 38 | func (m *protoModule) Execute(targets map[string]pgs.File, pkgs map[string]pgs.Package) []pgs.Artifact { 39 | for _, f := range targets { 40 | if len(f.Services()) == 0 { 41 | continue 42 | } 43 | name := m.ctx.OutputPath(f).SetExt(".server.go") 44 | m.AddGeneratorTemplateFile(name.String(), m.tpl, f) 45 | } 46 | return m.Artifacts() 47 | } 48 | 49 | // the code template 50 | const serviceTpl = `package {{ .Package.ProtoName }} 51 | 52 | import ( 53 | "context" 54 | "encoding/json" 55 | "net/http" 56 | "io/ioutil" 57 | ) 58 | 59 | {{ range .Services }} 60 | func Register{{ .Name }}HTTPMux(mux *http.ServeMux, srv {{ .Name }}Server) { 61 | {{ range .Methods}} 62 | {{ $method := printf "/%s.%s/%s" .Service.Package.ProtoName .Service.Name .Name }} 63 | mux.HandleFunc("{{ $method }}", func(w http.ResponseWriter, r *http.Request) { 64 | in := new({{ .Input.Name }}) 65 | inJSON, err := ioutil.ReadAll(r.Body) 66 | defer r.Body.Close() 67 | 68 | if err != nil { 69 | http.Error(w, err.Error(), 500) 70 | return 71 | } 72 | 73 | err = json.Unmarshal(inJSON, in) 74 | if err != nil { 75 | http.Error(w, err.Error(), 500) 76 | return 77 | } 78 | 79 | ret, err := srv.{{ .Name }}(context.Background(), in) 80 | if err != nil { 81 | http.Error(w, err.Error(), 500) 82 | return 83 | } 84 | retJSON, err := json.Marshal(ret) 85 | if err != nil { 86 | http.Error(w, err.Error(), 500) 87 | return 88 | } 89 | w.Write(retJSON) 90 | }) 91 | {{ end }} 92 | } 93 | {{ end }} 94 | ` 95 | -------------------------------------------------------------------------------- /wasm/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") 2 | 3 | filegroup(name = "files", 4 | srcs = [ 5 | "instance_table.go", 6 | "main.go", 7 | "search_bar.go", 8 | "manager.go", 9 | ], 10 | 11 | visibility = ["//visibility:public"], 12 | ) 13 | 14 | go_library( 15 | name = "go_default_library", 16 | srcs = [ 17 | ":files", 18 | ], 19 | importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/wasm", 20 | visibility = ["//visibility:private"], 21 | deps = [ 22 | "//protos/api:go_default_library", 23 | "//server:go_default_library", 24 | "@com_github_maxence_charriere_go_app_v9//pkg/app:go_default_library", 25 | ], 26 | ) 27 | 28 | go_binary( 29 | name = "app.wasm", 30 | embed = [":go_default_library"], 31 | goarch = "wasm", 32 | goos = "js", 33 | visibility = ["//visibility:public"], 34 | ) 35 | 36 | filegroup( 37 | name = "icon", 38 | srcs = [ "icon.png" ], 39 | visibility = ["//visibility:public"], 40 | ) 41 | -------------------------------------------------------------------------------- /wasm/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grahamjenson/bazel-golang-wasm-proto/6c3ff6112eb729b267724e130de4311fc6bd2ddb/wasm/icon.png -------------------------------------------------------------------------------- /wasm/instance_table.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api" 7 | "github.com/maxence-charriere/go-app/v9/pkg/app" 8 | ) 9 | 10 | type InstanceTable struct { 11 | app.Compo 12 | // Must be a pointer, or else the widget construction will end up incorrect. 13 | Manager *Manager 14 | instances []*api.Instance 15 | } 16 | 17 | func (p *InstanceTable) SetManager(manager *Manager) { 18 | p.Manager = manager 19 | if p.Manager == nil { 20 | panic("p.Manager == nil") 21 | } 22 | } 23 | 24 | func (p *InstanceTable) Render() app.UI { 25 | 26 | nodes := []app.UI{} 27 | for _, i := range p.instances { 28 | nodes = append(nodes, app.Tr().Body( 29 | app.Td().Body(app.Text(i.Name)), 30 | app.Td().Body(app.Text(i.InstanceType)), 31 | app.Td().Body(app.Text(fmt.Sprintf("%v", i.Ecu))), 32 | app.Td().Body(app.Text(fmt.Sprintf("%v", i.Memory))), 33 | app.Td().Body(app.Text(i.Network)), 34 | app.Td().Body(app.Text(i.Price)), 35 | )) 36 | } 37 | 38 | return app.Table().Class("table").Body( 39 | app.Tr().Body( 40 | app.Th().Scope("col").Body(app.Text("Name")), 41 | app.Th().Scope("col").Body(app.Text("Instance Type")), 42 | app.Th().Scope("col").Body(app.Text("ECU")), 43 | app.Th().Scope("col").Body(app.Text("Mem")), 44 | app.Th().Scope("col").Body(app.Text("Network")), 45 | app.Th().Scope("col").Body(app.Text("Price")), 46 | ), 47 | app.TBody().Body(nodes...), 48 | ) 49 | 50 | } 51 | -------------------------------------------------------------------------------- /wasm/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "log" 7 | "net/http" 8 | 9 | "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api" 10 | "github.com/grahamjenson/bazel-golang-wasm-proto/server" 11 | "github.com/maxence-charriere/go-app/v9/pkg/app" 12 | ) 13 | 14 | var ( 15 | bootstrapLoc = flag.String("bootstrap-css-path", "", "path to the bootstrap.css file") 16 | wasmLoc = flag.String("wasm-path", "", "path to the web app wasm file") 17 | iconLoc = flag.String("icon-path", "", "path to the icon") 18 | port = flag.Int("port", 7000, "default port to use") 19 | ) 20 | 21 | func main() { 22 | app.RouteFunc("/", func() app.Composer { 23 | // Note that app.Route can not be used to initialize `manager` correctly. 24 | // This is confusing, but seems to be go-app design choice. 25 | // See: https://github.com/maxence-charriere/go-app/issues/853 26 | manager := Manager{ 27 | SearchBar: &SearchBar{}, 28 | InstanceTable: &InstanceTable{}, 29 | } 30 | manager.SearchBar.SetManager(&manager) 31 | manager.InstanceTable.SetManager(&manager) 32 | return &manager 33 | }) 34 | app.RunWhenOnBrowser() 35 | 36 | // This is the server part. 37 | // Unclear why the below has to be in this file, but 38 | // otherwise it does not work. 39 | flag.Parse() 40 | 41 | // Since locations of these files may vary over bazel versions, 42 | // this is one way to ensure they keep working. 43 | if *bootstrapLoc == "" { 44 | log.Fatalf("The flag --bootstrap-css-path is required.") 45 | } 46 | if *wasmLoc == "" { 47 | log.Fatalf("The flag --bootstrap-css-path is required.") 48 | } 49 | 50 | app := &app.Handler{ 51 | Title: "EC2Instances", 52 | Author: "Graham Jenson", 53 | Styles: []string{"/web/bootstrap.css"}, 54 | Icon: app.Icon{ 55 | // Not setting the icon defaults it to go-app icon which is not 56 | // fetchable due to CORS blocking. 57 | Default: "/web/icon.png", 58 | }, 59 | } 60 | 61 | mux := http.NewServeMux() 62 | 63 | // In go-app v9, the static resources *must* be in `/web/...`. 64 | mux.HandleFunc("/web/app.wasm", func(w http.ResponseWriter, r *http.Request) { 65 | log.Printf("handling %v\n", *wasmLoc) 66 | http.ServeFile(w, r, *wasmLoc) 67 | }) 68 | 69 | mux.HandleFunc("/web/icon.png", func(w http.ResponseWriter, r *http.Request) { 70 | log.Printf("handling %v\n", *iconLoc) 71 | http.ServeFile(w, r, *iconLoc) 72 | }) 73 | 74 | mux.HandleFunc("/web/bootstrap.css", func(w http.ResponseWriter, r *http.Request) { 75 | log.Printf("handling %v\n", *bootstrapLoc) 76 | // go-app v9 requires setting content type on CSS. 77 | r.Header.Add("Content-Type", "text/css") 78 | http.ServeFile(w, r, *bootstrapLoc) 79 | }) 80 | 81 | // Handle API 82 | api.RegisterApiHTTPMux(mux, &server.Server{}) 83 | 84 | // Handle go-app 85 | mux.Handle("/", app) 86 | 87 | log.Printf("starting local server on http://localhost:%v\n", *port) 88 | log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", *port), mux)) 89 | } 90 | -------------------------------------------------------------------------------- /wasm/manager.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api" 7 | "github.com/maxence-charriere/go-app/v9/pkg/app" 8 | ) 9 | 10 | // Manager is the main controller of this application, also the root Body 11 | type Manager struct { 12 | app.Compo 13 | 14 | // These must be initialized in app.RenderFunc, or OnMount() for 15 | // Manager, and must be pointers. 16 | // See: https://github.com/maxence-charriere/go-app/issues/853. 17 | // This is not obvious. 18 | SearchBar *SearchBar 19 | InstanceTable *InstanceTable 20 | } 21 | 22 | func (h *Manager) Render() app.UI { 23 | return app.Div().Body( 24 | app.Header().Body( 25 | app. 26 | Nav(). 27 | Class("navbar navbar-expand-lg navbar-light bg-light"). 28 | Body(h.SearchBar), 29 | ), 30 | app.Div().Class("container-fluid").Body(h.InstanceTable), 31 | ) 32 | } 33 | 34 | func (h *Manager) Search(q string) []*api.Instance { 35 | instances, err := api.CallApiSearch(api.SearchRequest{ 36 | Query: q, 37 | }) 38 | 39 | if err != nil { 40 | fmt.Println("Search Error:", err) 41 | return []*api.Instance{} 42 | } 43 | 44 | return instances.Instances 45 | } 46 | 47 | func (h *Manager) UpdateInstances(q string) { 48 | instances := h.Search(q) 49 | h.InstanceTable.instances = instances 50 | h.InstanceTable.Update() 51 | } 52 | -------------------------------------------------------------------------------- /wasm/search_bar.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/maxence-charriere/go-app/v9/pkg/app" 5 | ) 6 | 7 | type SearchBar struct { 8 | app.Compo 9 | // Must be a pointer, or else the widget construction will end up incorrect. 10 | Manager *Manager 11 | searchString string 12 | } 13 | 14 | func (p *SearchBar) SetManager(manager *Manager) { 15 | p.Manager = manager 16 | if p.Manager == nil { 17 | panic("p.Manager == nil") 18 | } 19 | } 20 | 21 | func (p *SearchBar) Render() app.UI { 22 | input := app.Input(). 23 | Class("form-control"). 24 | Value(p.searchString). 25 | Placeholder("t2.small"). 26 | AutoFocus(true). 27 | OnKeyUp(p.OnInputChange) 28 | 29 | return app.Div().Class("input-group").Body( 30 | app. 31 | Div(). 32 | Class("input-group-prepend"). 33 | Body(app. 34 | Span(). 35 | Class("input-group-text"). 36 | Body(app.Text("🔍"))), 37 | input, 38 | ) 39 | } 40 | 41 | func (p *SearchBar) OnInputChange(ctx app.Context, e app.Event) { 42 | if p == nil { 43 | panic("Manager == nil, why?") 44 | } 45 | src := ctx.JSSrc() 46 | p.searchString = src.Get("value").String() 47 | p.Update() 48 | if p.Manager == nil { 49 | panic("p.Manager == nil") 50 | } 51 | p.Manager.UpdateInstances(p.searchString) 52 | } 53 | --------------------------------------------------------------------------------