Skip to content

Commit

Permalink
Remove easyjson (#697)
Browse files Browse the repository at this point in the history
We have replaced easyjson with encoding/json

* Updating metric name

* Removing easyjson from Zanzibar

* Removing easyjson from Zanzibar

* Remove debug statements

* Update readme

* Review changes

* Adding changes for googlenow_test

* Fix i64 types
  • Loading branch information
tejaswiagarwal committed Apr 7, 2020
1 parent 47652c7 commit f4a7b33
Show file tree
Hide file tree
Showing 32 changed files with 25 additions and 23,509 deletions.
6 changes: 1 addition & 5 deletions Makefile
Expand Up @@ -208,10 +208,6 @@ run: run-example-gateway
go-docs:
godoc -http=:6060

.PHONY: clean-easyjson
clean-easyjson:
find . -name "*.bak" -delete
find . -name "easyjson-bootstrap*.go" -delete

.PHONY: kill-dead-benchmarks
kill-dead-benchmarks:
Expand Down Expand Up @@ -265,7 +261,7 @@ clean-vendor:
rm -rf ./vendor

.PHONY: clean
clean: clean-easyjson clean-cover clean-vendor
clean: clean-cover clean-vendor
go clean
rm -f $(PROGS)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -306,7 +306,7 @@ Zanzibar provides HTTP and TChannel runtime components for both clients and serv
Zanzibar expects non-custom clients and endpoints to define their interfaces using Thrift ([Zanzibar Thrift file semantics](https://github.com/uber/zanzibar/blob/master/docs/thrift.md)). For example, the `bar` endpoint defines its interfaces using the [bar.thrift](https://github.com/uber/zanzibar/blob/master/examples/example-gateway/idl/endpoints/bar/bar.thrift) as specified in [hello.yaml](https://github.com/uber/zanzibar/blob/master/examples/example-gateway/endpoints/bar/hello.yaml#L5). The data types in such thrift files must have their equivalents in Go.

- For tchannel clients/endpoints, network communication is Thrift over TChannel. Zanzibar uses [thriftrw](https://github.com/thriftrw/thriftrw-go) to generate Go structs and thrift (de)serializers;
- For http clients/endpoints, network communication is JSON over HTTP. Zanzibar uses [thriftrw](https://github.com/thriftrw/thriftrw-go) to generate Go structs and then uses [easyjson](https://github.com/mailru/easyjson) to generate JSON (de)serializers.
- For http clients/endpoints, network communication is JSON over HTTP. Zanzibar uses [thriftrw](https://github.com/thriftrw/thriftrw-go) to generate Go structs and encoding/json for (de)serializing.

The [pre-steps.sh](https://github.com/uber/zanzibar/blob/master/codegen/runner/pre-steps.sh) script takes care of this part of the code generation, and places the generated code under `build/gen-code` directory.

Expand Down
20 changes: 0 additions & 20 deletions codegen/runner/pre-steps.sh
Expand Up @@ -31,10 +31,6 @@ fi
THRIFTRW_SRCS="$(echo "$THRIFTRW_SRCS" | xargs -n1 | sort | uniq)"

DIRNAME="$(dirname "$0")"
EASY_JSON_RAW_DIR="$DIRNAME/../../scripts/easy_json"
EASY_JSON_DIR="$(cd "$EASY_JSON_RAW_DIR";pwd)"
EASY_JSON_FILE="$EASY_JSON_DIR/easy_json.go"
EASY_JSON_BINARY="$EASY_JSON_DIR/easy_json"
RESOLVE_THRIFT_FILE="$DIRNAME/../../scripts/resolve_thrift/main.go"
RESOLVE_THRIFT_BINARY="$DIRNAME/../../scripts/resolve_thrift/resolve_thrift"
RESOLVE_I64_FILE="$DIRNAME/../../scripts/resolve_i64/main.go"
Expand Down Expand Up @@ -139,10 +135,6 @@ end=$(date +%s)
runtime=$((end-start))
echo "Generated structs : +$runtime"

go build -o "$EASY_JSON_BINARY" "$EASY_JSON_FILE"
end=$(date +%s)
runtime=$((end-start))
echo "Compiled easyjson : +$runtime"

go build -o "$RESOLVE_THRIFT_BINARY" "$RESOLVE_THRIFT_FILE"
go build -o "$RESOLVE_I64_BINARY" "$RESOLVE_I64_FILE"
Expand Down Expand Up @@ -190,16 +182,4 @@ for config_file in ${config_files}; do
done
target_dirs=($(echo "$target_dirs" | tr ' ' '\n' | sort | uniq))

echo "Generating JSON Marshal/Unmarshal"
thriftrw_gofiles=(
$(find "${target_dirs[@]}" -name "*.go" | \
grep -v "versioncheck.go" | \
grep -v "easyjson.go" | sort)
)
"$EASY_JSON_BINARY" -all -- "${thriftrw_gofiles[@]}"

goimports -w "$BUILD_DIR/gen-code/"

end=$(date +%s)
runtime=$((end-start))
echo "Generated structs : +$runtime"

0 comments on commit f4a7b33

Please sign in to comment.