MCPcopy
hub / github.com/urfave/cli / getSize

Function getSize

scripts/build.go:683–708  ·  view source on GitHub ↗
(ctx context.Context, sourcePath, builtPath, tags string)

Source from the content-addressed store, hash-verified

681}
682
683func getSize(ctx context.Context, sourcePath, builtPath, tags string) (int64, error) {
684 args := []string{"build"}
685
686 if tags != "" {
687 args = append(args, []string{"-tags", tags}...)
688 }
689
690 args = append(args, []string{
691 "-o", builtPath,
692 "-ldflags", "-s -w",
693 sourcePath,
694 }...)
695
696 if err := runCmd(ctx, "go", args...); err != nil {
697 fmt.Println("issue getting size for example binary")
698 return 0, err
699 }
700
701 fileInfo, err := os.Stat(builtPath)
702 if err != nil {
703 fmt.Println("issue getting size for example binary")
704 return 0, err
705 }
706
707 return fileInfo.Size(), nil
708}

Callers 1

Calls 1

runCmdFunction · 0.85

Tested by

no test coverage detected