From 5ebf4ce72df0b43c5224ee98328043da0d5712d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 04:26:37 +0000 Subject: [PATCH 1/6] Bump actions/setup-go from 4 to 5 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa9d3e0..b8b89a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} From 3dd430869cfdaf7cd2c3c6857bd247ed35f501f6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 7 Dec 2023 12:30:03 +0300 Subject: [PATCH 2/6] Add build tags support --- README.md | 4 ++++ cli/cli.go | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0dd1ed..a301826 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Usage: goheft {options} go-file Options + --tags, -t tag… Build tags (mergeble) --external, -E Shadow internal packages --pager, -P Use pager for long output --min-size, -m size Don't show with size less than defined @@ -86,6 +87,9 @@ Examples goheft application.go -m 750kb Show size of each used library which greater than 750kb + + goheft application.go -t release,slim + Use tags when building and counting size ``` ### Build Status diff --git a/cli/cli.go b/cli/cli.go index 89dda8d..e2ad262 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -37,11 +37,12 @@ import ( const ( APP = "GoHeft" - VER = "0.7.0" + VER = "0.8.0" DESC = "Utility for listing sizes of used static libraries" ) const ( + OPT_TAGS = "t:tags" OPT_EXTERNAL = "E:external" OPT_PAGER = "P:pager" OPT_MIN_SIZE = "m:min-size" @@ -78,6 +79,7 @@ func (s LibInfoSlice) Less(i, j int) bool { return s[i].Size < s[j].Size } // ////////////////////////////////////////////////////////////////////////////////// // var optMap = options.Map{ + OPT_TAGS: {Mergeble: true}, OPT_EXTERNAL: {Type: options.BOOL}, OPT_PAGER: {Type: options.BOOL}, OPT_MIN_SIZE: {}, @@ -323,7 +325,17 @@ func printStats(libs LibInfoSlice) { func compileBinary(file string) (string, error) { var workDir string - cmd := exec.Command("go", "build", "-work", "-a", "-v", file) + cmd := exec.Command("go", "build", "-work", "-a", "-v") + + if options.Has(OPT_TAGS) { + cmd.Args = append(cmd.Args, + "-tags", + strings.ReplaceAll(options.GetS(OPT_TAGS), " ", ","), + ) + } + + cmd.Args = append(cmd.Args, file) + stderrReader, err := cmd.StderrPipe() if err != nil { @@ -444,6 +456,7 @@ func genUsage() *usage.Info { info.AppNameColorTag = colorTagApp + info.AddOption(OPT_TAGS, "Build tags {s-}(mergeble){!}", "tag…") info.AddOption(OPT_EXTERNAL, "Shadow internal packages") info.AddOption(OPT_PAGER, "Use pager for long output") info.AddOption(OPT_MIN_SIZE, "Don't show with size less than defined", "size") @@ -453,6 +466,7 @@ func genUsage() *usage.Info { info.AddExample("application.go", "Show size of each used library") info.AddExample("application.go -m 750kb", "Show size of each used library which greater than 750kb") + info.AddExample("application.go -t release,slim", "Use tags when building and counting size") return info } From e958a656e67eb1b3b78a7e49788a62cdc6c3622f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 03:19:05 +0000 Subject: [PATCH 3/6] Bump github.com/essentialkaos/ek/v12 from 12.90.1 to 12.91.0 Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.90.1 to 12.91.0. - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v12.90.1...v12.91.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b3652ef..9edab2e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/essentialkaos/depsy v1.1.0 - github.com/essentialkaos/ek/v12 v12.90.1 + github.com/essentialkaos/ek/v12 v12.91.0 ) require golang.org/x/sys v0.15.0 // indirect diff --git a/go.sum b/go.sum index 3e30591..bcdbf36 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI= github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8= -github.com/essentialkaos/ek/v12 v12.90.1 h1:ID950cnz4xgpqqFzhleP5xaVoLnPwuiykdH3FrogD/E= -github.com/essentialkaos/ek/v12 v12.90.1/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU= +github.com/essentialkaos/ek/v12 v12.91.0 h1:xgSMRmcOz7qMlkmKdw1YCMsLhkVdUNsS64ns4ACgTjc= +github.com/essentialkaos/ek/v12 v12.91.0/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= From 5bff2798bf3cccd1ac75299fce2fb2807a49a170 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 13 Dec 2023 13:40:28 +0300 Subject: [PATCH 4/6] Dependencies update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9edab2e..8247311 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/essentialkaos/depsy v1.1.0 - github.com/essentialkaos/ek/v12 v12.91.0 + github.com/essentialkaos/ek/v12 v12.92.0 ) require golang.org/x/sys v0.15.0 // indirect diff --git a/go.sum b/go.sum index bcdbf36..70b6add 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI= github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8= -github.com/essentialkaos/ek/v12 v12.91.0 h1:xgSMRmcOz7qMlkmKdw1YCMsLhkVdUNsS64ns4ACgTjc= -github.com/essentialkaos/ek/v12 v12.91.0/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU= +github.com/essentialkaos/ek/v12 v12.92.0 h1:3JIkHWNA6MNkJOfqzMWJ8jN9sRM7nRi7URoFRVFHZzI= +github.com/essentialkaos/ek/v12 v12.92.0/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= From 1affda885f11513b7f760c7cbc1711c852c954c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 04:18:58 +0000 Subject: [PATCH 5/6] Bump github/codeql-action from 2 to 3 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0d8f170..bfc4df5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,9 +25,9 @@ jobs: fetch-depth: 2 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: go - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 From f1d896c5372e83c1c1add7b5711bed5c9d0d5a68 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Tue, 19 Dec 2023 01:03:47 +0300 Subject: [PATCH 6/6] Code refactoring --- cli/cli.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index e2ad262..056cfd1 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -428,11 +428,11 @@ func printCompletion() int { switch options.GetS(OPT_COMPLETION) { case "bash": - fmt.Printf(bash.Generate(info, "goheft", "go")) + fmt.Print(bash.Generate(info, "goheft", "go")) case "fish": - fmt.Printf(fish.Generate(info, "goheft")) + fmt.Print(fish.Generate(info, "goheft")) case "zsh": - fmt.Printf(zsh.Generate(info, optMap, "goheft", "*.go")) + fmt.Print(zsh.Generate(info, optMap, "goheft", "*.go")) default: return 1 }