Skip to content

Commit 65fa14c

Browse files
committed
feat: Added generation for binsize.
1 parent 261aa0d commit 65fa14c

File tree

4 files changed

+2888
-1
lines changed

4 files changed

+2888
-1
lines changed

BINSIZE.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Size of the compiled binary by Go package
2+
3+
![Binary sizes](binsize.png)

Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ current_dir := $(dir $(mkfile_path))
1111
# Global stuff.
1212

1313
GO=$(shell which go)
14-
HOMEBREW_PACKAGES=bash bats-core coreutils findutils git git-lfs go jq nodejs pre-commit python@3.11 tfschema trufflesecurity/trufflehog/trufflehog
14+
HOMEBREW_PACKAGES=bash bats-core coreutils findutils git git-lfs go jq librsvg nodejs pre-commit python@3.11 tfschema trufflesecurity/trufflehog/trufflehog
1515

1616
# Determine the operating system and CPU arch.
1717
OS=$(shell uname -o | tr '[:upper:]' '[:lower:]')
@@ -61,6 +61,7 @@ install-tools-go:
6161
$(GO) install github.com/bitfield/gotestdox/cmd/gotestdox@latest
6262
$(GO) install github.com/google/osv-scanner/cmd/osv-scanner@v1
6363
$(GO) install github.com/goph/licensei/cmd/licensei@latest
64+
$(GO) install github.com/nikolaydubina/go-binsize-treemap@latest
6465
$(GO) install github.com/orlangure/gocovsh@latest
6566
$(GO) install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
6667
$(GO) install github.com/securego/gosec/v2/cmd/gosec@latest
@@ -196,6 +197,14 @@ docs-serve:
196197
open http://localhost:6060/pkg/github.com/northwood-labs/terraform-provider-corefunc/corefunc/
197198
godoc -index -links
198199

200+
.PHONY: binsize
201+
## binsize: [docs] Analyze the size of the binary by Go package.
202+
binsize:
203+
@ $(ECHO) " "
204+
@ $(ECHO) "\033[1;33m=====> Displaying Go HTTP documentation...\033[0m"
205+
$(GO) tool nm -size "$(GOBIN)/$(BINARY_NAME)" | go-binsize-treemap > binsize.svg
206+
rsvg-convert --width=2000 --format=png --output="binsize.png" "binsize.svg"
207+
199208
#-------------------------------------------------------------------------------
200209
# Linting
201210

binsize.png

131 KB
Loading

0 commit comments

Comments
 (0)