Skip to content

Commit

Permalink
Replace instances of to_json() method with json.encode(..) (#3896)
Browse files Browse the repository at this point in the history
The to_json and to_proto methods on struct are deprecated and will be
removed. The "json" and "proto" builtin modules should be used instead.

This replaces instances of `foo.to_json()` with `json.encode(foo)`.
  • Loading branch information
c-mita committed Mar 19, 2024
1 parent cac338e commit aeb83e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/private/tools/path.bzl
Expand Up @@ -112,7 +112,7 @@ def _go_path_impl(ctx):
f.basename,
)
manifest_file = ctx.actions.declare_file(ctx.label.name + "~manifest")
manifest_entries_json = [e.to_json() for e in manifest_entries]
manifest_entries_json = [json.encode(e) for e in manifest_entries]
manifest_content = "[\n " + ",\n ".join(manifest_entries_json) + "\n]"
ctx.actions.write(manifest_file, manifest_content)
inputs.append(manifest_file)
Expand Down
2 changes: 1 addition & 1 deletion go/tools/gopackagesdriver/aspect.bzl
Expand Up @@ -77,7 +77,7 @@ def _go_archive_to_pkg(archive):

def make_pkg_json(ctx, name, pkg_info):
pkg_json_file = ctx.actions.declare_file(name + ".pkg.json")
ctx.actions.write(pkg_json_file, content = pkg_info.to_json())
ctx.actions.write(pkg_json_file, content = json.encode(pkg_info))
return pkg_json_file

def _go_pkg_info_aspect_impl(target, ctx):
Expand Down

0 comments on commit aeb83e8

Please sign in to comment.