Skip to content

Commit

Permalink
feat: Added generation for binsize.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Oct 26, 2023
1 parent 261aa0d commit 65fa14c
Show file tree
Hide file tree
Showing 4 changed files with 2,888 additions and 1 deletion.
3 changes: 3 additions & 0 deletions BINSIZE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Size of the compiled binary by Go package

![Binary sizes](binsize.png)
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ current_dir := $(dir $(mkfile_path))
# Global stuff.

GO=$(shell which go)
HOMEBREW_PACKAGES=bash bats-core coreutils findutils git git-lfs go jq nodejs pre-commit [email protected] tfschema trufflesecurity/trufflehog/trufflehog
HOMEBREW_PACKAGES=bash bats-core coreutils findutils git git-lfs go jq librsvg nodejs pre-commit [email protected] tfschema trufflesecurity/trufflehog/trufflehog

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

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

#-------------------------------------------------------------------------------
# Linting

Expand Down
Binary file added binsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 65fa14c

Please sign in to comment.