Skip to content

Commit

Permalink
Merge pull request #1992 from urfave/internals-split
Browse files Browse the repository at this point in the history
Split internal/ into examples/ and scripts/
  • Loading branch information
dearchap authored Oct 24, 2024
2 parents 2071b59 + b87b683 commit fe2c626
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ coverage:
default:
threshold: 5%
ignore:
- internal
- examples
- scripts
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
/.local/
/site/
coverage.txt
internal/*/built-example
examples/*/built-example
vendor
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# are very important so that maintainers and contributors can focus their
# attention on files that are primarily Go.

GO_RUN_BUILD := go run internal/build/build.go
GO_RUN_BUILD := go run scripts/build.go

.PHONY: all
all: generate vet test check-binary-size gfmrun

# NOTE: this is a special catch-all rule to run any of the commands
# defined in internal/build/build.go with optional arguments passed
# defined in scripts/build.go with optional arguments passed
# via GFLAGS (global flags) and FLAGS (command-specific flags), e.g.:
#
# $ make test GFLAGS='--packages cli'
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions internal/build/build.go → scripts/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func main() {
},
&cli.StringSliceFlag{
Name: "packages",
Value: []string{"cli", "internal/build"},
Value: []string{"cli", "scripts"},
},
},
}
Expand Down Expand Up @@ -408,10 +408,10 @@ func GfmrunActionFunc(ctx context.Context, cmd *cli.Command) error {
// of https://github.com/urfave/cli/issues/1057
func checkBinarySizeActionFunc(ctx context.Context, cmd *cli.Command) (err error) {
const (
cliSourceFilePath = "./internal/example-cli/example-cli.go"
cliBuiltFilePath = "./internal/example-cli/built-example"
helloSourceFilePath = "./internal/example-hello-world/example-hello-world.go"
helloBuiltFilePath = "./internal/example-hello-world/built-example"
cliSourceFilePath = "./examples/example-cli/example-cli.go"
cliBuiltFilePath = "./examples/example-cli/built-example"
helloSourceFilePath = "./examples/example-hello-world/example-hello-world.go"
helloBuiltFilePath = "./examples/example-hello-world/built-example"
desiredMaxBinarySize = 2.2
desiredMinBinarySize = 1.49
mbStringFormatter = "%.1fMB"
Expand Down Expand Up @@ -457,7 +457,7 @@ func checkBinarySizeActionFunc(ctx context.Context, cmd *cli.Command) (err error
fmt.Println("") // visual spacing
fmt.Println(" The binary is smaller than the target min size, which is great news!")
fmt.Println(" That means that your changes are shrinking the binary size.")
fmt.Println(" You'll want to go into ./internal/build/build.go and decrease")
fmt.Println(" You'll want to go into ./scripts/build.go and decrease")
fmt.Println(" the desiredMinBinarySize, and also probably decrease the ")
fmt.Println(" desiredMaxBinarySize by the same amount. That will ensure that")
fmt.Println(" future PRs will enforce the newly shrunk binary sizes.")
Expand All @@ -477,7 +477,7 @@ func checkBinarySizeActionFunc(ctx context.Context, cmd *cli.Command) (err error
fmt.Println(" Larger binary sizes for this package can dissuade its use.")
fmt.Println(" If this change is worth the increase, then we can up the")
fmt.Println(" desired max binary size. To do that you'll want to go into")
fmt.Println(" ./internal/build/build.go and increase the desiredMaxBinarySize,")
fmt.Println(" ./scripts/build.go and increase the desiredMaxBinarySize,")
fmt.Println(" and increase the desiredMinBinarySize by the same amount.")
fmt.Println("") // visual spacing
os.Exit(1)
Expand Down Expand Up @@ -525,7 +525,7 @@ func EnsureGoimportsActionFunc(ctx context.Context, cmd *cli.Command) error {
ctx,
"goimports",
"-d",
filepath.Join(topDir, "internal/build/build.go"),
filepath.Join(topDir, "scripts/build.go"),
); err == nil {
return nil
}
Expand Down

0 comments on commit fe2c626

Please sign in to comment.