Skip to content

Commit

Permalink
Internal cleanup
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 716558829
Change-Id: Iea58f7809b3b18861444445063ac49a41fba4d02
  • Loading branch information
cushon authored and copybara-github committed Jan 17, 2025
1 parent a66d109 commit 8954fe9
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/tools/jar_to_module_info/jar_to_module_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,21 @@ package main
import (
"archive/zip"
"bytes"
"context"
"fmt"
"strings"

"bitbucket.org/creachadair/stringset"
"flag"
"log"
"os"

"bitbucket.org/creachadair/stringset"
)

var (
inputPath = flag.String("input", "", "input jar path")
outputPath = flag.String("output", "", "output modile-info path")
)

func writeFilePortable(ctx context.Context, filename string, data []byte) error {
// A portable shim around the google-internal WriteFile() and the more commonly-used public version.
// The Google-internal WriteFile() takes an additional Context object.
return os.WriteFile(filename, data, 0o400)
}

func portableInit() {
flag.Parse()
}
Expand Down Expand Up @@ -67,7 +61,7 @@ func main() {
fmt.Fprintf(&output, " exports %s;\n", strings.Replace(p, "/", ".", -1))
}
fmt.Fprintln(&output, "}")
err = writeFilePortable(context.Background(), *outputPath, output.Bytes())
err = os.WriteFile(*outputPath, output.Bytes(), 0o400)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 8954fe9

Please sign in to comment.