Decrease memory footprint by realigning struct members.

This commit is contained in:
2023-03-31 15:34:49 +01:00
parent 817fb91dba
commit a73dd78bd5
4 changed files with 23 additions and 19 deletions
+6 -6
View File
@@ -51,10 +51,10 @@ type Wording struct {
}
type Force struct {
Commit string
Patch int
Minor int
Major int
Commit string
Existing bool
Strict bool
}
@@ -68,24 +68,24 @@ type SemVer struct {
}
type Setup struct {
RepositoryHandler *git.Repository
RepositoryName string
RepositoryLocalPath string
RepositoryHandler *git.Repository
LocalConfigFile string
Wording Wording
Force Force
Commits []CommitDetails
Tags []TagDetails
Semver SemVer
Wording Wording
Force Force
Generate bool
LocalConfigFile string
UseLocal bool
}
type CommitDetails struct {
Timestamp time.Time
Hash string
Author string
Message string
Timestamp time.Time
}
type TagDetails struct {
+11 -11
View File
@@ -52,8 +52,8 @@ func (suite *Tests) TestSetup_getSemver() {
}
tests := []struct {
name string
fields fields
want string
fields fields
}{
{
name: "Return 1.3.7",
@@ -106,13 +106,13 @@ func (suite *Tests) TestSetup_getSemver() {
func (suite *Tests) TestSetup_ForcedVersioning() {
type fields struct {
Semver SemVer
Force Force
Semver SemVer
}
tests := []struct {
name string
fields fields
want string
fields fields
}{
{
name: "No versioning",
@@ -211,8 +211,8 @@ func (suite *Tests) TestSetup_ReadConfig() {
}
tests := []struct {
name string
fields fields
args args
fields fields
wordingEmpty bool
wantErr bool
}{
@@ -284,14 +284,14 @@ func (suite *Tests) Test_checkMatches() {
func (suite *Tests) TestSetup_ListCommits() {
type fields struct {
RepositoryHandler *git.Repository
RepositoryName string
RepositoryLocalPath string
RepositoryHandler *git.Repository
LocalConfigFile string
Commits []CommitDetails
Semver SemVer
Wording Wording
Force Force
Commits []CommitDetails
Semver SemVer
}
tests := []struct {
@@ -349,8 +349,8 @@ func (suite *Tests) TestSetup_ListCommits() {
func (suite *Tests) TestSetup_CalculateSemver() {
type fields struct {
RepositoryName string
Force Force
LocalConfigFile string
Force Force
}
type wantSemver struct {
Major int
@@ -584,14 +584,14 @@ func (suite *Tests) Test_parseExistingSemver() {
func (suite *Tests) TestSetup_ListExistingTags() {
type fields struct {
RepositoryHandler *git.Repository
RepositoryName string
RepositoryLocalPath string
RepositoryHandler *git.Repository
LocalConfigFile string
Commits []CommitDetails
Semver SemVer
Wording Wording
Force Force
Commits []CommitDetails
Semver SemVer
}
tests := []struct {
+2 -2
View File
@@ -6,7 +6,7 @@ require (
github.com/go-git/go-git/v5 v5.6.1
github.com/lithammer/fuzzysearch v1.1.5
github.com/lukaszraczylo/go-simple-graphql v1.0.74
github.com/lukaszraczylo/pandati v0.0.18
github.com/lukaszraczylo/pandati v0.0.20
github.com/melbahja/got v0.7.0
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.15.0
@@ -16,7 +16,7 @@ require (
require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/allegro/bigcache/v3 v3.1.0 // indirect
github.com/avast/retry-go v3.0.0+incompatible // indirect
+4
View File
@@ -47,6 +47,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20230113180642-068501e20d67/go.mod h1:UBY
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 h1:dGAdTcqheKrQ/TW76sAcmO2IorwXplUw2inPkOzykbw=
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec h1:eQusauqzE1cAFR5hGnwkuSmFxKoy3+j9/cVaDeYfjjs=
github.com/ProtonMail/go-crypto v0.0.0-20230331115716-d34776aa93ec/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
@@ -208,6 +210,8 @@ github.com/lukaszraczylo/pandati v0.0.17 h1:p5317W4mXmyLPHvpebRvIGzwoQpt5jBWpkkt
github.com/lukaszraczylo/pandati v0.0.17/go.mod h1:2/+hBv1EighvY4J1J1lo4IrC+OZ8GmQ5eDwJygLT0Do=
github.com/lukaszraczylo/pandati v0.0.18 h1:6khtDY6QXkiyh4a3dzHtIzx/9UqUGfHjzKBCA0SIurI=
github.com/lukaszraczylo/pandati v0.0.18/go.mod h1:Aqlc0KH+ssvrscYYbEKMv7n5cFwe+0MjsJbikNz1h60=
github.com/lukaszraczylo/pandati v0.0.20 h1:LqF7CS3z9Zi04KwEY8wd/YUpfWKSwi0nc7pagKQLXHc=
github.com/lukaszraczylo/pandati v0.0.20/go.mod h1:ZegK9ll9UebKV1uNMF73qdLb43G/O4CSOdPglu6NniQ=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=