diff --git a/database/build_test.go b/database/build_test.go index 55fdb735..754f26d9 100644 --- a/database/build_test.go +++ b/database/build_test.go @@ -107,8 +107,7 @@ func TestDatabase_Build_Nullify(t *testing.T) { func TestDatabase_Build_Nullify_Empty(t *testing.T) { // setup types - b := &Build{} - b = nil + var b *Build // run test got := b.Nullify() diff --git a/database/hook_test.go b/database/hook_test.go index e5537fa0..e8fe3fbb 100644 --- a/database/hook_test.go +++ b/database/hook_test.go @@ -54,8 +54,7 @@ func TestDatabase_Hook_Nullify(t *testing.T) { func TestDatabase_Hook_Nullify_Empty(t *testing.T) { // setup types - h := &Hook{} - h = nil + var h *Hook // run test got := h.Nullify() diff --git a/database/log_test.go b/database/log_test.go index 014ddc83..8de52553 100644 --- a/database/log_test.go +++ b/database/log_test.go @@ -41,8 +41,7 @@ func TestDatabase_Log_Nullify(t *testing.T) { func TestDatabase_Log_Nullify_Empty(t *testing.T) { // setup types - l := &Log{} - l = nil + var l *Log // run test got := l.Nullify() diff --git a/database/repo_test.go b/database/repo_test.go index 47761c2b..078c50ff 100644 --- a/database/repo_test.go +++ b/database/repo_test.go @@ -63,8 +63,7 @@ func TestDatabase_Repo_Nullify(t *testing.T) { func TestDatabase_Repo_Nullify_Empty(t *testing.T) { // setup types - r := &Repo{} - r = nil + var r *Repo // run test got := r.Nullify() diff --git a/database/secret_test.go b/database/secret_test.go index 6faf478a..048f193b 100644 --- a/database/secret_test.go +++ b/database/secret_test.go @@ -47,8 +47,7 @@ func TestDatabase_Secret_Nullify(t *testing.T) { func TestDatabase_Secret_Nullify_Empty(t *testing.T) { // setup types - s := &Secret{} - s = nil + var s *Secret // run test got := s.Nullify() diff --git a/database/service_test.go b/database/service_test.go index c72ef3fe..7a1e1976 100644 --- a/database/service_test.go +++ b/database/service_test.go @@ -53,8 +53,7 @@ func TestDatabase_Service_Nullify(t *testing.T) { func TestDatabase_Service_Nullify_Empty(t *testing.T) { // setup types - s := &Service{} - s = nil + var s *Service // run test got := s.Nullify() diff --git a/database/step_test.go b/database/step_test.go index 6bb0fb58..0b4c2272 100644 --- a/database/step_test.go +++ b/database/step_test.go @@ -61,8 +61,7 @@ func TestDatabase_Step_Nullify(t *testing.T) { func TestDatabase_Step_Nullify_Empty(t *testing.T) { // setup types - s := &Step{} - s = nil + var s *Step // run test got := s.Nullify() diff --git a/database/user_test.go b/database/user_test.go index 1d5d2fd0..460db7d4 100644 --- a/database/user_test.go +++ b/database/user_test.go @@ -41,8 +41,7 @@ func TestDatabase_User_Nullify(t *testing.T) { func TestDatabase_User_Nullify_Empty(t *testing.T) { // setup types - u := &User{} - u = nil + var u *User // run test got := u.Nullify() diff --git a/library/build.go b/library/build.go index 57fa7b34..18f20393 100644 --- a/library/build.go +++ b/library/build.go @@ -46,6 +46,7 @@ func (b *Build) GetID() int64 { if b == nil || b.ID == nil { return 0 } + return *b.ID } @@ -58,6 +59,7 @@ func (b *Build) GetRepoID() int64 { if b == nil || b.RepoID == nil { return 0 } + return *b.RepoID } @@ -70,6 +72,7 @@ func (b *Build) GetNumber() int { if b == nil || b.Number == nil { return 0 } + return *b.Number } @@ -82,6 +85,7 @@ func (b *Build) GetParent() int { if b == nil || b.Parent == nil { return 0 } + return *b.Parent } @@ -94,6 +98,7 @@ func (b *Build) GetEvent() string { if b == nil || b.Event == nil { return "" } + return *b.Event } @@ -106,6 +111,7 @@ func (b *Build) GetStatus() string { if b == nil || b.Status == nil { return "" } + return *b.Status } @@ -118,6 +124,7 @@ func (b *Build) GetError() string { if b == nil || b.Error == nil { return "" } + return *b.Error } @@ -130,6 +137,7 @@ func (b *Build) GetEnqueued() int64 { if b == nil || b.Enqueued == nil { return 0 } + return *b.Enqueued } @@ -142,6 +150,7 @@ func (b *Build) GetCreated() int64 { if b == nil || b.Created == nil { return 0 } + return *b.Created } @@ -154,6 +163,7 @@ func (b *Build) GetStarted() int64 { if b == nil || b.Started == nil { return 0 } + return *b.Started } @@ -166,6 +176,7 @@ func (b *Build) GetFinished() int64 { if b == nil || b.Finished == nil { return 0 } + return *b.Finished } @@ -178,6 +189,7 @@ func (b *Build) GetDeploy() string { if b == nil || b.Deploy == nil { return "" } + return *b.Deploy } @@ -190,6 +202,7 @@ func (b *Build) GetClone() string { if b == nil || b.Clone == nil { return "" } + return *b.Clone } @@ -202,6 +215,7 @@ func (b *Build) GetSource() string { if b == nil || b.Source == nil { return "" } + return *b.Source } @@ -214,6 +228,7 @@ func (b *Build) GetTitle() string { if b == nil || b.Title == nil { return "" } + return *b.Title } @@ -226,6 +241,7 @@ func (b *Build) GetMessage() string { if b == nil || b.Message == nil { return "" } + return *b.Message } @@ -238,6 +254,7 @@ func (b *Build) GetCommit() string { if b == nil || b.Commit == nil { return "" } + return *b.Commit } @@ -250,6 +267,7 @@ func (b *Build) GetSender() string { if b == nil || b.Sender == nil { return "" } + return *b.Sender } @@ -262,6 +280,7 @@ func (b *Build) GetAuthor() string { if b == nil || b.Author == nil { return "" } + return *b.Author } @@ -274,6 +293,7 @@ func (b *Build) GetEmail() string { if b == nil || b.Email == nil { return "" } + return *b.Email } @@ -286,6 +306,7 @@ func (b *Build) GetLink() string { if b == nil || b.Link == nil { return "" } + return *b.Link } @@ -298,6 +319,7 @@ func (b *Build) GetBranch() string { if b == nil || b.Branch == nil { return "" } + return *b.Branch } @@ -310,6 +332,7 @@ func (b *Build) GetRef() string { if b == nil || b.Ref == nil { return "" } + return *b.Ref } @@ -322,6 +345,7 @@ func (b *Build) GetBaseRef() string { if b == nil || b.BaseRef == nil { return "" } + return *b.BaseRef } @@ -334,6 +358,7 @@ func (b *Build) GetHost() string { if b == nil || b.Host == nil { return "" } + return *b.Host } @@ -346,6 +371,7 @@ func (b *Build) GetRuntime() string { if b == nil || b.Runtime == nil { return "" } + return *b.Runtime } @@ -358,6 +384,7 @@ func (b *Build) GetDistribution() string { if b == nil || b.Distribution == nil { return "" } + return *b.Distribution } @@ -370,6 +397,7 @@ func (b *Build) SetID(v int64) { if b == nil { return } + b.ID = &v } @@ -382,6 +410,7 @@ func (b *Build) SetRepoID(v int64) { if b == nil { return } + b.RepoID = &v } @@ -394,6 +423,7 @@ func (b *Build) SetNumber(v int) { if b == nil { return } + b.Number = &v } @@ -406,6 +436,7 @@ func (b *Build) SetParent(v int) { if b == nil { return } + b.Parent = &v } @@ -418,6 +449,7 @@ func (b *Build) SetEvent(v string) { if b == nil { return } + b.Event = &v } @@ -430,6 +462,7 @@ func (b *Build) SetStatus(v string) { if b == nil { return } + b.Status = &v } @@ -442,6 +475,7 @@ func (b *Build) SetError(v string) { if b == nil { return } + b.Error = &v } @@ -454,6 +488,7 @@ func (b *Build) SetEnqueued(v int64) { if b == nil { return } + b.Enqueued = &v } @@ -466,6 +501,7 @@ func (b *Build) SetCreated(v int64) { if b == nil { return } + b.Created = &v } @@ -478,6 +514,7 @@ func (b *Build) SetStarted(v int64) { if b == nil { return } + b.Started = &v } @@ -490,6 +527,7 @@ func (b *Build) SetFinished(v int64) { if b == nil { return } + b.Finished = &v } @@ -502,6 +540,7 @@ func (b *Build) SetDeploy(v string) { if b == nil { return } + b.Deploy = &v } @@ -514,6 +553,7 @@ func (b *Build) SetClone(v string) { if b == nil { return } + b.Clone = &v } @@ -526,6 +566,7 @@ func (b *Build) SetSource(v string) { if b == nil { return } + b.Source = &v } @@ -538,6 +579,7 @@ func (b *Build) SetTitle(v string) { if b == nil { return } + b.Title = &v } @@ -550,6 +592,7 @@ func (b *Build) SetMessage(v string) { if b == nil { return } + b.Message = &v } @@ -562,6 +605,7 @@ func (b *Build) SetCommit(v string) { if b == nil { return } + b.Commit = &v } @@ -574,6 +618,7 @@ func (b *Build) SetSender(v string) { if b == nil { return } + b.Sender = &v } @@ -586,6 +631,7 @@ func (b *Build) SetAuthor(v string) { if b == nil { return } + b.Author = &v } @@ -598,6 +644,7 @@ func (b *Build) SetEmail(v string) { if b == nil { return } + b.Email = &v } @@ -610,6 +657,7 @@ func (b *Build) SetLink(v string) { if b == nil { return } + b.Link = &v } @@ -622,6 +670,7 @@ func (b *Build) SetBranch(v string) { if b == nil { return } + b.Branch = &v } @@ -634,6 +683,7 @@ func (b *Build) SetRef(v string) { if b == nil { return } + b.Ref = &v } @@ -646,6 +696,7 @@ func (b *Build) SetBaseRef(v string) { if b == nil { return } + b.BaseRef = &v } @@ -658,6 +709,7 @@ func (b *Build) SetHost(v string) { if b == nil { return } + b.Host = &v } @@ -670,6 +722,7 @@ func (b *Build) SetRuntime(v string) { if b == nil { return } + b.Runtime = &v } @@ -682,6 +735,7 @@ func (b *Build) SetDistribution(v string) { if b == nil { return } + b.Distribution = &v } diff --git a/library/build_test.go b/library/build_test.go index 9c658eb8..89792916 100644 --- a/library/build_test.go +++ b/library/build_test.go @@ -186,7 +186,7 @@ func TestLibrary_Build_Getters(t *testing.T) { func TestLibrary_Build_Getters_Empty(t *testing.T) { // setup types - b := &Build{} + var b *Build // run test gotID := b.GetID() @@ -305,7 +305,7 @@ func TestLibrary_Build_Setters(t *testing.T) { num := 1 num64 := int64(num) str := "foo" - b := &Build{} + b := new(Build) wantID := num64 wantRepoID := num64 @@ -449,8 +449,7 @@ func TestLibrary_Build_Setters(t *testing.T) { func TestLibrary_Build_Setters_Empty(t *testing.T) { // setup types - b := &Build{} - b = nil + var b *Build // Run tests b.SetID(0) diff --git a/library/executor.go b/library/executor.go index d9677df0..33bf2f67 100644 --- a/library/executor.go +++ b/library/executor.go @@ -30,6 +30,7 @@ func (e *Executor) GetID() int64 { if e == nil || e.ID == nil { return 0 } + return *e.ID } @@ -42,6 +43,7 @@ func (e *Executor) GetHost() string { if e == nil || e.Host == nil { return "" } + return *e.Host } @@ -54,6 +56,7 @@ func (e *Executor) GetRuntime() string { if e == nil || e.Runtime == nil { return "" } + return *e.Runtime } @@ -66,6 +69,7 @@ func (e *Executor) GetDistribution() string { if e == nil || e.Distribution == nil { return "" } + return *e.Distribution } @@ -78,6 +82,7 @@ func (e *Executor) GetBuild() Build { if e == nil || e.Build == nil { return Build{} } + return *e.Build } @@ -90,6 +95,7 @@ func (e *Executor) GetRepo() Repo { if e == nil || e.Repo == nil { return Repo{} } + return *e.Repo } @@ -102,6 +108,7 @@ func (e *Executor) GetPipeline() pipeline.Build { if e == nil || e.Pipeline == nil { return pipeline.Build{} } + return *e.Pipeline } @@ -114,6 +121,7 @@ func (e *Executor) SetID(v int64) { if e == nil { return } + e.ID = &v } @@ -126,6 +134,7 @@ func (e *Executor) SetHost(v string) { if e == nil { return } + e.Host = &v } @@ -138,6 +147,7 @@ func (e *Executor) SetRuntime(v string) { if e == nil { return } + e.Runtime = &v } @@ -150,6 +160,7 @@ func (e *Executor) SetDistribution(v string) { if e == nil { return } + e.Distribution = &v } @@ -162,6 +173,7 @@ func (e *Executor) SetBuild(v Build) { if e == nil { return } + e.Build = &v } @@ -174,6 +186,7 @@ func (e *Executor) SetRepo(v Repo) { if e == nil { return } + e.Repo = &v } @@ -186,6 +199,7 @@ func (e *Executor) SetPipeline(v pipeline.Build) { if e == nil { return } + e.Pipeline = &v } diff --git a/library/executor_test.go b/library/executor_test.go index 156cfbca..9bb37b95 100644 --- a/library/executor_test.go +++ b/library/executor_test.go @@ -161,7 +161,7 @@ func TestLibrary_Executor_Getters(t *testing.T) { func TestLibrary_Executor_Getters_Empty(t *testing.T) { // setup types - e := &Executor{} + e := new(Executor) // run test gotID := e.GetID() @@ -293,7 +293,7 @@ func TestLibrary_Executor_Setters(t *testing.T) { }, }, } - e := &Executor{} + e := new(Executor) wantID := num64 wantHost := str @@ -337,7 +337,7 @@ func TestLibrary_Executor_Setters(t *testing.T) { func TestLibrary_Executor_Setters_Empty(t *testing.T) { // setup types - e := &Executor{} + var e *Executor // Run tests e.SetID(0) diff --git a/library/hook.go b/library/hook.go index 0063983a..1ce32468 100644 --- a/library/hook.go +++ b/library/hook.go @@ -31,6 +31,7 @@ func (h *Hook) GetID() int64 { if h == nil || h.ID == nil { return 0 } + return *h.ID } @@ -43,6 +44,7 @@ func (h *Hook) GetRepoID() int64 { if h == nil || h.RepoID == nil { return 0 } + return *h.RepoID } @@ -55,6 +57,7 @@ func (h *Hook) GetBuildID() int64 { if h == nil || h.BuildID == nil { return 0 } + return *h.BuildID } @@ -67,6 +70,7 @@ func (h *Hook) GetNumber() int { if h == nil || h.Number == nil { return 0 } + return *h.Number } @@ -79,6 +83,7 @@ func (h *Hook) GetSourceID() string { if h == nil || h.SourceID == nil { return "" } + return *h.SourceID } @@ -91,6 +96,7 @@ func (h *Hook) GetCreated() int64 { if h == nil || h.Created == nil { return 0 } + return *h.Created } @@ -103,6 +109,7 @@ func (h *Hook) GetHost() string { if h == nil || h.Host == nil { return "" } + return *h.Host } @@ -115,6 +122,7 @@ func (h *Hook) GetEvent() string { if h == nil || h.Event == nil { return "" } + return *h.Event } @@ -127,6 +135,7 @@ func (h *Hook) GetBranch() string { if h == nil || h.Branch == nil { return "" } + return *h.Branch } @@ -139,6 +148,7 @@ func (h *Hook) GetError() string { if h == nil || h.Error == nil { return "" } + return *h.Error } @@ -151,6 +161,7 @@ func (h *Hook) GetStatus() string { if h == nil || h.Status == nil { return "" } + return *h.Status } @@ -163,6 +174,7 @@ func (h *Hook) GetLink() string { if h == nil || h.Link == nil { return "" } + return *h.Link } @@ -175,6 +187,7 @@ func (h *Hook) SetID(v int64) { if h == nil { return } + h.ID = &v } @@ -187,6 +200,7 @@ func (h *Hook) SetRepoID(v int64) { if h == nil { return } + h.RepoID = &v } @@ -199,6 +213,7 @@ func (h *Hook) SetBuildID(v int64) { if h == nil { return } + h.BuildID = &v } @@ -211,6 +226,7 @@ func (h *Hook) SetNumber(v int) { if h == nil { return } + h.Number = &v } @@ -223,6 +239,7 @@ func (h *Hook) SetSourceID(v string) { if h == nil { return } + h.SourceID = &v } @@ -235,6 +252,7 @@ func (h *Hook) SetCreated(v int64) { if h == nil { return } + h.Created = &v } @@ -247,6 +265,7 @@ func (h *Hook) SetHost(v string) { if h == nil { return } + h.Host = &v } @@ -271,6 +290,7 @@ func (h *Hook) SetBranch(v string) { if h == nil { return } + h.Branch = &v } @@ -283,6 +303,7 @@ func (h *Hook) SetError(v string) { if h == nil { return } + h.Error = &v } @@ -295,6 +316,7 @@ func (h *Hook) SetStatus(v string) { if h == nil { return } + h.Status = &v } @@ -307,6 +329,7 @@ func (h *Hook) SetLink(v string) { if h == nil { return } + h.Link = &v } diff --git a/library/hook_test.go b/library/hook_test.go index 7108169b..06d5180a 100644 --- a/library/hook_test.go +++ b/library/hook_test.go @@ -27,6 +27,7 @@ func TestLibrary_Hook_Getters(t *testing.T) { wantLink := "https://github.com/github/octocat/settings/hooks/1" h := new(Hook) + h.SetID(wantID) h.SetRepoID(wantRepoID) h.SetBuildID(wantBuildID) @@ -94,7 +95,7 @@ func TestLibrary_Hook_Getters(t *testing.T) { func TestLibrary_Hook_Getters_Empty(t *testing.T) { // setup types - h := &Hook{} + h := new(Hook) // run test gotID := h.GetID() @@ -163,7 +164,7 @@ func TestLibrary_Hook_Setters(t *testing.T) { wantStatus := "success" wantLink := "https://github.com/github/octocat/settings/hooks/1" - h := &Hook{} + h := new(Hook) // Run tests h.SetID(wantID) @@ -219,8 +220,7 @@ func TestLibrary_Hook_Setters(t *testing.T) { func TestLibrary_Hook_Setters_Empty(t *testing.T) { // setup types - h := &Hook{} - h = nil + var h *Hook // Run tests h.SetID(0) diff --git a/library/log.go b/library/log.go index 80666627..fd3db271 100644 --- a/library/log.go +++ b/library/log.go @@ -25,6 +25,7 @@ func (l *Log) GetID() int64 { if l == nil || l.ID == nil { return 0 } + return *l.ID } @@ -37,6 +38,7 @@ func (l *Log) GetBuildID() int64 { if l == nil || l.BuildID == nil { return 0 } + return *l.BuildID } @@ -49,6 +51,7 @@ func (l *Log) GetRepoID() int64 { if l == nil || l.RepoID == nil { return 0 } + return *l.RepoID } @@ -61,6 +64,7 @@ func (l *Log) GetServiceID() int64 { if l == nil || l.ServiceID == nil { return 0 } + return *l.ServiceID } @@ -73,6 +77,7 @@ func (l *Log) GetStepID() int64 { if l == nil || l.StepID == nil { return 0 } + return *l.StepID } @@ -85,6 +90,7 @@ func (l *Log) GetData() []byte { if l == nil || l.Data == nil { return []byte{} } + return *l.Data } @@ -97,6 +103,7 @@ func (l *Log) SetID(v int64) { if l == nil { return } + l.ID = &v } @@ -109,6 +116,7 @@ func (l *Log) SetBuildID(v int64) { if l == nil { return } + l.BuildID = &v } @@ -121,6 +129,7 @@ func (l *Log) SetRepoID(v int64) { if l == nil { return } + l.RepoID = &v } @@ -133,6 +142,7 @@ func (l *Log) SetServiceID(v int64) { if l == nil { return } + l.ServiceID = &v } @@ -145,6 +155,7 @@ func (l *Log) SetStepID(v int64) { if l == nil { return } + l.StepID = &v } @@ -157,6 +168,7 @@ func (l *Log) SetData(v []byte) { if l == nil { return } + l.Data = &v } diff --git a/library/log_test.go b/library/log_test.go index 0bdabac6..c3155524 100644 --- a/library/log_test.go +++ b/library/log_test.go @@ -59,7 +59,7 @@ func TestLibrary_Log_Getters(t *testing.T) { func TestLibrary_Log_Getters_Empty(t *testing.T) { // setup types - l := &Log{} + l := new(Log) // run test gotID := l.GetID() @@ -89,7 +89,7 @@ func TestLibrary_Log_Setters(t *testing.T) { // setup types num64 := int64(1) bytes := []byte("foo") - l := &Log{} + l := new(Log) wantID := num64 wantServiceID := num64 @@ -128,8 +128,7 @@ func TestLibrary_Log_Setters(t *testing.T) { func TestLibrary_Log_Setters_Empty(t *testing.T) { // setup types - l := &Log{} - l = nil + var l *Log // run test l.SetID(0) diff --git a/library/login.go b/library/login.go index c5b784ff..12672ae6 100644 --- a/library/login.go +++ b/library/login.go @@ -33,6 +33,7 @@ func (l *Login) GetUsername() string { if l == nil || l.Username == nil { return "" } + return *l.Username } @@ -45,6 +46,7 @@ func (l *Login) GetPassword() string { if l == nil || l.Password == nil { return "" } + return *l.Password } @@ -57,6 +59,7 @@ func (l *Login) GetOTP() string { if l == nil || l.OTP == nil { return "" } + return *l.OTP } @@ -69,6 +72,7 @@ func (l *Login) GetToken() string { if l == nil || l.Token == nil { return "" } + return *l.Token } @@ -81,6 +85,7 @@ func (l *Login) SetUsername(v string) { if l == nil { return } + l.Username = &v } @@ -93,6 +98,7 @@ func (l *Login) SetPassword(v string) { if l == nil { return } + l.Password = &v } @@ -105,6 +111,7 @@ func (l *Login) SetOTP(v string) { if l == nil { return } + l.OTP = &v } @@ -117,6 +124,7 @@ func (l *Login) SetToken(v string) { if l == nil { return } + l.Token = &v } diff --git a/library/login_test.go b/library/login_test.go index a8d25d03..8078e65d 100644 --- a/library/login_test.go +++ b/library/login_test.go @@ -56,7 +56,7 @@ func TestLibrary_Login_Getters(t *testing.T) { func TestLibrary_Login_Getters_Empty(t *testing.T) { // setup types - l := &Login{} + l := new(Login) // run test gotUsername := l.GetUsername() @@ -81,7 +81,7 @@ func TestLibrary_Login_Getters_Empty(t *testing.T) { func TestLibrary_Login_Setters(t *testing.T) { // setup types str := "foo" - l := &Login{} + l := new(Login) wantUsername := str wantPassword := str wantOTP := str @@ -109,8 +109,7 @@ func TestLibrary_Login_Setters(t *testing.T) { func TestLibrary_Login_Setters_Empty(t *testing.T) { // setup types - l := &Login{} - l = nil + var l *Login // run test l.SetUsername("") diff --git a/library/repo.go b/library/repo.go index c7c8881e..eefa2059 100644 --- a/library/repo.go +++ b/library/repo.go @@ -36,6 +36,7 @@ func (r *Repo) GetID() int64 { if r == nil || r.ID == nil { return 0 } + return *r.ID } @@ -48,6 +49,7 @@ func (r *Repo) GetUserID() int64 { if r == nil || r.UserID == nil { return 0 } + return *r.UserID } @@ -60,6 +62,7 @@ func (r *Repo) GetOrg() string { if r == nil || r.Org == nil { return "" } + return *r.Org } @@ -72,6 +75,7 @@ func (r *Repo) GetName() string { if r == nil || r.Name == nil { return "" } + return *r.Name } @@ -84,6 +88,7 @@ func (r *Repo) GetFullName() string { if r == nil || r.FullName == nil { return "" } + return *r.FullName } @@ -96,6 +101,7 @@ func (r *Repo) GetLink() string { if r == nil || r.Link == nil { return "" } + return *r.Link } @@ -108,6 +114,7 @@ func (r *Repo) GetClone() string { if r == nil || r.Clone == nil { return "" } + return *r.Clone } @@ -120,6 +127,7 @@ func (r *Repo) GetBranch() string { if r == nil || r.Branch == nil { return "" } + return *r.Branch } @@ -132,6 +140,7 @@ func (r *Repo) GetTimeout() int64 { if r == nil || r.Timeout == nil { return 0 } + return *r.Timeout } @@ -144,6 +153,7 @@ func (r *Repo) GetVisibility() string { if r == nil || r.Visibility == nil { return "" } + return *r.Visibility } @@ -156,6 +166,7 @@ func (r *Repo) GetPrivate() bool { if r == nil || r.Private == nil { return false } + return *r.Private } @@ -168,6 +179,7 @@ func (r *Repo) GetTrusted() bool { if r == nil || r.Trusted == nil { return false } + return *r.Trusted } @@ -180,6 +192,7 @@ func (r *Repo) GetActive() bool { if r == nil || r.Active == nil { return false } + return *r.Active } @@ -192,6 +205,7 @@ func (r *Repo) GetAllowPull() bool { if r == nil || r.AllowPull == nil { return false } + return *r.AllowPull } @@ -204,6 +218,7 @@ func (r *Repo) GetAllowPush() bool { if r == nil || r.AllowPush == nil { return false } + return *r.AllowPush } @@ -216,6 +231,7 @@ func (r *Repo) GetAllowDeploy() bool { if r == nil || r.AllowDeploy == nil { return false } + return *r.AllowDeploy } @@ -228,6 +244,7 @@ func (r *Repo) GetAllowTag() bool { if r == nil || r.AllowTag == nil { return false } + return *r.AllowTag } @@ -240,6 +257,7 @@ func (r *Repo) SetID(v int64) { if r == nil { return } + r.ID = &v } @@ -252,6 +270,7 @@ func (r *Repo) SetUserID(v int64) { if r == nil { return } + r.UserID = &v } @@ -264,6 +283,7 @@ func (r *Repo) SetOrg(v string) { if r == nil { return } + r.Org = &v } @@ -276,6 +296,7 @@ func (r *Repo) SetName(v string) { if r == nil { return } + r.Name = &v } @@ -288,6 +309,7 @@ func (r *Repo) SetFullName(v string) { if r == nil { return } + r.FullName = &v } @@ -300,6 +322,7 @@ func (r *Repo) SetLink(v string) { if r == nil { return } + r.Link = &v } @@ -312,6 +335,7 @@ func (r *Repo) SetClone(v string) { if r == nil { return } + r.Clone = &v } @@ -324,6 +348,7 @@ func (r *Repo) SetBranch(v string) { if r == nil { return } + r.Branch = &v } @@ -336,6 +361,7 @@ func (r *Repo) SetTimeout(v int64) { if r == nil { return } + r.Timeout = &v } @@ -348,6 +374,7 @@ func (r *Repo) SetVisibility(v string) { if r == nil { return } + r.Visibility = &v } @@ -360,6 +387,7 @@ func (r *Repo) SetPrivate(v bool) { if r == nil { return } + r.Private = &v } @@ -372,6 +400,7 @@ func (r *Repo) SetTrusted(v bool) { if r == nil { return } + r.Trusted = &v } @@ -384,6 +413,7 @@ func (r *Repo) SetActive(v bool) { if r == nil { return } + r.Active = &v } @@ -396,6 +426,7 @@ func (r *Repo) SetAllowPull(v bool) { if r == nil { return } + r.AllowPull = &v } @@ -408,6 +439,7 @@ func (r *Repo) SetAllowPush(v bool) { if r == nil { return } + r.AllowPush = &v } @@ -420,6 +452,7 @@ func (r *Repo) SetAllowDeploy(v bool) { if r == nil { return } + r.AllowDeploy = &v } @@ -432,6 +465,7 @@ func (r *Repo) SetAllowTag(v bool) { if r == nil { return } + r.AllowTag = &v } diff --git a/library/repo_test.go b/library/repo_test.go index f723e8e4..68ab5fb5 100644 --- a/library/repo_test.go +++ b/library/repo_test.go @@ -127,7 +127,7 @@ func TestLibrary_Repo_Getters(t *testing.T) { func TestLibrary_Repo_Getters_Empty(t *testing.T) { // setup types - r := &Repo{} + r := new(Repo) // run test gotID := r.GetID() @@ -207,7 +207,7 @@ func TestLibrary_Repo_Setters(t *testing.T) { num := 1 num64 := int64(num) str := "foo" - r := &Repo{} + r := new(Repo) wantID := num64 wantUserID := num64 @@ -301,8 +301,7 @@ func TestLibrary_Repo_Setters(t *testing.T) { func TestLibrary_Repo_Setters_Empty(t *testing.T) { // setup types - r := &Repo{} - r = nil + var r *Repo // run test r.SetID(0) diff --git a/library/secret.go b/library/secret.go index 43896cc5..7f600bc0 100644 --- a/library/secret.go +++ b/library/secret.go @@ -97,6 +97,7 @@ func (s *Secret) GetID() int64 { if s == nil || s.ID == nil { return 0 } + return *s.ID } @@ -109,6 +110,7 @@ func (s *Secret) GetOrg() string { if s == nil || s.Org == nil { return "" } + return *s.Org } @@ -121,6 +123,7 @@ func (s *Secret) GetRepo() string { if s == nil || s.Repo == nil { return "" } + return *s.Repo } @@ -133,6 +136,7 @@ func (s *Secret) GetTeam() string { if s == nil || s.Team == nil { return "" } + return *s.Team } @@ -145,6 +149,7 @@ func (s *Secret) GetName() string { if s == nil || s.Name == nil { return "" } + return *s.Name } @@ -157,6 +162,7 @@ func (s *Secret) GetValue() string { if s == nil || s.Value == nil { return "" } + return *s.Value } @@ -169,6 +175,7 @@ func (s *Secret) GetType() string { if s == nil || s.Type == nil { return "" } + return *s.Type } @@ -181,6 +188,7 @@ func (s *Secret) GetImages() []string { if s == nil || s.Images == nil { return []string{} } + return *s.Images } @@ -193,6 +201,7 @@ func (s *Secret) GetEvents() []string { if s == nil || s.Events == nil { return []string{} } + return *s.Events } @@ -205,6 +214,7 @@ func (s *Secret) GetAllowCommand() bool { if s == nil || s.AllowCommand == nil { return false } + return *s.AllowCommand } @@ -217,6 +227,7 @@ func (s *Secret) SetID(v int64) { if s == nil { return } + s.ID = &v } @@ -229,6 +240,7 @@ func (s *Secret) SetOrg(v string) { if s == nil { return } + s.Org = &v } @@ -241,6 +253,7 @@ func (s *Secret) SetRepo(v string) { if s == nil { return } + s.Repo = &v } @@ -253,6 +266,7 @@ func (s *Secret) SetTeam(v string) { if s == nil { return } + s.Team = &v } @@ -265,6 +279,7 @@ func (s *Secret) SetName(v string) { if s == nil { return } + s.Name = &v } @@ -277,6 +292,7 @@ func (s *Secret) SetValue(v string) { if s == nil { return } + s.Value = &v } @@ -289,6 +305,7 @@ func (s *Secret) SetType(v string) { if s == nil { return } + s.Type = &v } @@ -301,6 +318,7 @@ func (s *Secret) SetImages(v []string) { if s == nil { return } + s.Images = &v } @@ -313,6 +331,7 @@ func (s *Secret) SetEvents(v []string) { if s == nil { return } + s.Events = &v } @@ -321,9 +340,11 @@ func (s *Secret) SetEvents(v []string) { // When the provided Secret type is nil, it // will set nothing and immediately return. func (s *Secret) SetAllowCommand(v bool) { + // return if Secret type is nil if s == nil { return } + s.AllowCommand = &v } diff --git a/library/secret_test.go b/library/secret_test.go index 4493574e..65bc4525 100644 --- a/library/secret_test.go +++ b/library/secret_test.go @@ -302,7 +302,7 @@ func TestLibrary_Secret_Getters(t *testing.T) { func TestLibrary_Secret_Getters_Empty(t *testing.T) { // setup types - s := &Secret{} + s := new(Secret) // run test gotID := s.GetID() @@ -355,7 +355,7 @@ func TestLibrary_Secret_Setters(t *testing.T) { arr := []string{"foo", "bar"} booL := true - s := &Secret{} + s := new(Secret) wantID := num64 wantOrg := str @@ -414,8 +414,7 @@ func TestLibrary_Secret_Setters(t *testing.T) { func TestLibrary_Secret_Setters_Empty(t *testing.T) { // setup types - s := &Secret{} - s = nil + var s *Secret // run test s.SetID(0) diff --git a/library/service.go b/library/service.go index c43bfdbc..d30a65c0 100644 --- a/library/service.go +++ b/library/service.go @@ -31,6 +31,7 @@ func (s *Service) GetID() int64 { if s == nil || s.ID == nil { return 0 } + return *s.ID } @@ -43,6 +44,7 @@ func (s *Service) GetBuildID() int64 { if s == nil || s.BuildID == nil { return 0 } + return *s.BuildID } @@ -55,6 +57,7 @@ func (s *Service) GetRepoID() int64 { if s == nil || s.RepoID == nil { return 0 } + return *s.RepoID } @@ -67,6 +70,7 @@ func (s *Service) GetNumber() int { if s == nil || s.Number == nil { return 0 } + return *s.Number } @@ -79,6 +83,7 @@ func (s *Service) GetName() string { if s == nil || s.Name == nil { return "" } + return *s.Name } @@ -91,6 +96,7 @@ func (s *Service) GetImage() string { if s == nil || s.Image == nil { return "" } + return *s.Image } @@ -103,6 +109,7 @@ func (s *Service) GetStatus() string { if s == nil || s.Status == nil { return "" } + return *s.Status } @@ -115,6 +122,7 @@ func (s *Service) GetError() string { if s == nil || s.Error == nil { return "" } + return *s.Error } @@ -127,6 +135,7 @@ func (s *Service) GetExitCode() int { if s == nil || s.ExitCode == nil { return 0 } + return *s.ExitCode } @@ -139,6 +148,7 @@ func (s *Service) GetCreated() int64 { if s == nil || s.Created == nil { return 0 } + return *s.Created } @@ -151,6 +161,7 @@ func (s *Service) GetStarted() int64 { if s == nil || s.Started == nil { return 0 } + return *s.Started } @@ -163,6 +174,7 @@ func (s *Service) GetFinished() int64 { if s == nil || s.Finished == nil { return 0 } + return *s.Finished } @@ -175,6 +187,7 @@ func (s *Service) SetID(v int64) { if s == nil { return } + s.ID = &v } @@ -187,6 +200,7 @@ func (s *Service) SetBuildID(v int64) { if s == nil { return } + s.BuildID = &v } @@ -199,6 +213,7 @@ func (s *Service) SetRepoID(v int64) { if s == nil { return } + s.RepoID = &v } @@ -211,6 +226,7 @@ func (s *Service) SetNumber(v int) { if s == nil { return } + s.Number = &v } @@ -223,6 +239,7 @@ func (s *Service) SetName(v string) { if s == nil { return } + s.Name = &v } @@ -235,6 +252,7 @@ func (s *Service) SetImage(v string) { if s == nil { return } + s.Image = &v } @@ -247,6 +265,7 @@ func (s *Service) SetStatus(v string) { if s == nil { return } + s.Status = &v } @@ -259,6 +278,7 @@ func (s *Service) SetError(v string) { if s == nil { return } + s.Error = &v } @@ -271,6 +291,7 @@ func (s *Service) SetExitCode(v int) { if s == nil { return } + s.ExitCode = &v } @@ -283,6 +304,7 @@ func (s *Service) SetCreated(v int64) { if s == nil { return } + s.Created = &v } @@ -295,6 +317,7 @@ func (s *Service) SetStarted(v int64) { if s == nil { return } + s.Started = &v } @@ -307,6 +330,7 @@ func (s *Service) SetFinished(v int64) { if s == nil { return } + s.Finished = &v } diff --git a/library/service_test.go b/library/service_test.go index efae7561..1372b30f 100644 --- a/library/service_test.go +++ b/library/service_test.go @@ -96,7 +96,7 @@ func TestService_Getters(t *testing.T) { func TestService_Getters_Empty(t *testing.T) { // setup types - s := &Service{} + s := new(Service) // run test gotID := s.GetID() @@ -155,7 +155,7 @@ func TestLibrary_Service_Setters(t *testing.T) { num := 1 num64 := int64(num) str := "foo" - s := &Service{} + s := new(Service) wantID := num64 wantBuildID := num64 @@ -224,8 +224,7 @@ func TestLibrary_Service_Setters(t *testing.T) { func TestLibrary_Service_Setters_Empty(t *testing.T) { // setup types - s := &Service{} - s = nil + var s *Service // run test s.SetID(0) diff --git a/library/step.go b/library/step.go index 3a918047..61ee0d66 100644 --- a/library/step.go +++ b/library/step.go @@ -35,6 +35,7 @@ func (s *Step) GetID() int64 { if s == nil || s.ID == nil { return 0 } + return *s.ID } @@ -47,6 +48,7 @@ func (s *Step) GetBuildID() int64 { if s == nil || s.BuildID == nil { return 0 } + return *s.BuildID } @@ -59,6 +61,7 @@ func (s *Step) GetRepoID() int64 { if s == nil || s.RepoID == nil { return 0 } + return *s.RepoID } @@ -71,6 +74,7 @@ func (s *Step) GetNumber() int { if s == nil || s.Number == nil { return 0 } + return *s.Number } @@ -83,6 +87,7 @@ func (s *Step) GetName() string { if s == nil || s.Name == nil { return "" } + return *s.Name } @@ -95,6 +100,7 @@ func (s *Step) GetImage() string { if s == nil || s.Image == nil { return "" } + return *s.Image } @@ -107,6 +113,7 @@ func (s *Step) GetStage() string { if s == nil || s.Stage == nil { return "" } + return *s.Stage } @@ -119,6 +126,7 @@ func (s *Step) GetStatus() string { if s == nil || s.Status == nil { return "" } + return *s.Status } @@ -131,6 +139,7 @@ func (s *Step) GetError() string { if s == nil || s.Error == nil { return "" } + return *s.Error } @@ -143,6 +152,7 @@ func (s *Step) GetExitCode() int { if s == nil || s.ExitCode == nil { return 0 } + return *s.ExitCode } @@ -155,6 +165,7 @@ func (s *Step) GetCreated() int64 { if s == nil || s.Created == nil { return 0 } + return *s.Created } @@ -167,6 +178,7 @@ func (s *Step) GetStarted() int64 { if s == nil || s.Started == nil { return 0 } + return *s.Started } @@ -179,6 +191,7 @@ func (s *Step) GetFinished() int64 { if s == nil || s.Finished == nil { return 0 } + return *s.Finished } @@ -191,6 +204,7 @@ func (s *Step) GetHost() string { if s == nil || s.Host == nil { return "" } + return *s.Host } @@ -203,6 +217,7 @@ func (s *Step) GetRuntime() string { if s == nil || s.Runtime == nil { return "" } + return *s.Runtime } @@ -215,6 +230,7 @@ func (s *Step) GetDistribution() string { if s == nil || s.Distribution == nil { return "" } + return *s.Distribution } @@ -227,6 +243,7 @@ func (s *Step) SetID(v int64) { if s == nil { return } + s.ID = &v } @@ -239,6 +256,7 @@ func (s *Step) SetBuildID(v int64) { if s == nil { return } + s.BuildID = &v } @@ -251,6 +269,7 @@ func (s *Step) SetRepoID(v int64) { if s == nil { return } + s.RepoID = &v } @@ -263,6 +282,7 @@ func (s *Step) SetNumber(v int) { if s == nil { return } + s.Number = &v } @@ -275,6 +295,7 @@ func (s *Step) SetName(v string) { if s == nil { return } + s.Name = &v } @@ -287,6 +308,7 @@ func (s *Step) SetImage(v string) { if s == nil { return } + s.Image = &v } @@ -299,6 +321,7 @@ func (s *Step) SetStage(v string) { if s == nil { return } + s.Stage = &v } @@ -323,6 +346,7 @@ func (s *Step) SetError(v string) { if s == nil { return } + s.Error = &v } @@ -335,6 +359,7 @@ func (s *Step) SetExitCode(v int) { if s == nil { return } + s.ExitCode = &v } @@ -347,6 +372,7 @@ func (s *Step) SetCreated(v int64) { if s == nil { return } + s.Created = &v } @@ -359,6 +385,7 @@ func (s *Step) SetStarted(v int64) { if s == nil { return } + s.Started = &v } @@ -371,6 +398,7 @@ func (s *Step) SetFinished(v int64) { if s == nil { return } + s.Finished = &v } @@ -383,6 +411,7 @@ func (s *Step) SetHost(v string) { if s == nil { return } + s.Host = &v } @@ -395,6 +424,7 @@ func (s *Step) SetRuntime(v string) { if s == nil { return } + s.Runtime = &v } @@ -407,6 +437,7 @@ func (s *Step) SetDistribution(v string) { if s == nil { return } + s.Distribution = &v } diff --git a/library/step_test.go b/library/step_test.go index d8c77553..2f83478b 100644 --- a/library/step_test.go +++ b/library/step_test.go @@ -120,7 +120,7 @@ func TestStep_Getters(t *testing.T) { func TestStep_Getters_Empty(t *testing.T) { // setup types - s := &Step{} + s := new(Step) // run test gotID := s.GetID() @@ -195,7 +195,7 @@ func TestLibrary_Step_Setters(t *testing.T) { num := 1 num64 := int64(num) str := "foo" - s := &Step{} + s := new(Step) wantID := num64 wantBuildID := num64 @@ -284,8 +284,7 @@ func TestLibrary_Step_Setters(t *testing.T) { func TestLibrary_Step_Setters_Empty(t *testing.T) { // setup types - s := &Step{} - s = nil + var s *Step // run test s.SetID(0) diff --git a/library/user.go b/library/user.go index 1006b5f1..34a79b4d 100644 --- a/library/user.go +++ b/library/user.go @@ -25,6 +25,7 @@ func (u *User) GetID() int64 { if u == nil || u.ID == nil { return 0 } + return *u.ID } @@ -37,6 +38,7 @@ func (u *User) GetName() string { if u == nil || u.Name == nil { return "" } + return *u.Name } @@ -49,6 +51,7 @@ func (u *User) GetToken() string { if u == nil || u.Token == nil { return "" } + return *u.Token } @@ -61,6 +64,7 @@ func (u *User) GetHash() string { if u == nil || u.Hash == nil { return "" } + return *u.Hash } @@ -73,6 +77,7 @@ func (u *User) GetActive() bool { if u == nil || u.Active == nil { return false } + return *u.Active } @@ -85,6 +90,7 @@ func (u *User) GetAdmin() bool { if u == nil || u.Admin == nil { return false } + return *u.Admin } @@ -97,6 +103,7 @@ func (u *User) SetID(v int64) { if u == nil { return } + u.ID = &v } @@ -109,6 +116,7 @@ func (u *User) SetName(v string) { if u == nil { return } + u.Name = &v } @@ -121,6 +129,7 @@ func (u *User) SetToken(v string) { if u == nil { return } + u.Token = &v } @@ -133,6 +142,7 @@ func (u *User) SetHash(v string) { if u == nil { return } + u.Hash = &v } @@ -145,6 +155,7 @@ func (u *User) SetActive(v bool) { if u == nil { return } + u.Active = &v } @@ -157,6 +168,7 @@ func (u *User) SetAdmin(v bool) { if u == nil { return } + u.Admin = &v } diff --git a/library/user_test.go b/library/user_test.go index 2ed28df7..93780c16 100644 --- a/library/user_test.go +++ b/library/user_test.go @@ -60,7 +60,7 @@ func TestLibrary_User_Getters(t *testing.T) { func TestLibrary_User_Getters_Empty(t *testing.T) { // setup types - u := &User{} + u := new(User) // run test gotID := u.GetID() @@ -95,7 +95,7 @@ func TestLibrary_User_Setters(t *testing.T) { booL := false num64 := int64(1) str := "foo" - u := &User{} + u := new(User) wantID := num64 wantName := str @@ -134,8 +134,7 @@ func TestLibrary_User_Setters(t *testing.T) { func TestLibrary_User_Setters_Empty(t *testing.T) { // setup types - u := &User{} - u = nil + var u *User // run test u.SetID(0) diff --git a/pipeline/ruleset.go b/pipeline/ruleset.go index 63774c9d..b9aa5a9f 100644 --- a/pipeline/ruleset.go +++ b/pipeline/ruleset.go @@ -103,10 +103,8 @@ func (r *Rules) Empty() bool { func (r *Rules) Match(from *RuleData, op string) bool { // if the path ruletype is provided if len(from.Path) > 0 { - // if the "or" operator is provided in the ruleset if strings.EqualFold(op, "or") { - // iterate through each path in the ruletype for _, p := range from.Path { diff --git a/raw/map.go b/raw/map.go index 09a25311..0d66a581 100644 --- a/raw/map.go +++ b/raw/map.go @@ -29,7 +29,6 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { // attempt to unmarshal as a string slice type err := json.Unmarshal(b, &jsonSlice) if err == nil { - // iterate through each element in the json slice for _, v := range jsonSlice { // split each slice element into key/value pairs @@ -41,6 +40,7 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { // overwrite existing StringSliceMap *s = targetMap + return nil } @@ -50,7 +50,6 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { // attempt to unmarshal as map of strings err = json.Unmarshal(b, &jsonMap) if err == nil { - // iterate through each item in the json map for k, v := range jsonMap { // append each key/value pair to our target map @@ -59,10 +58,11 @@ func (s *StringSliceMap) UnmarshalJSON(b []byte) error { // overwrite existing StringSliceMap *s = targetMap + return nil } - return errors.New("Failed to unmarshal StringSliceMap") + return errors.New("unable to unmarshal into StringSliceMap") } // UnmarshalYAML implements the Unmarshaler interface for the StringSliceMap type. @@ -76,7 +76,6 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error // attempt to unmarshal as a string slice type err := unmarshal(&yamlSlice) if err == nil { - // iterate through each element in the yaml slice for _, v := range yamlSlice { // split each slice element into key/value pairs @@ -88,6 +87,7 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error // overwrite existing StringSliceMap *s = targetMap + return nil } @@ -97,7 +97,6 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error // attempt to unmarshal as map of strings err = unmarshal(&yamlMap) if err == nil { - // iterate through each item in the yaml map for k, v := range yamlMap { // append each key/value pair to our target map @@ -106,8 +105,9 @@ func (s *StringSliceMap) UnmarshalYAML(unmarshal func(interface{}) error) error // overwrite existing StringSliceMap *s = targetMap + return nil } - return errors.New("Failed to unmarshal StringSliceMap") + return errors.New("unable to unmarshal into StringSliceMap") } diff --git a/raw/slice.go b/raw/slice.go index d7c7e433..cbb4f79d 100644 --- a/raw/slice.go +++ b/raw/slice.go @@ -25,9 +25,9 @@ func (s *StringSlice) UnmarshalJSON(b []byte) error { // attempt to unmarshal as a string type err := json.Unmarshal(b, &jsonString) if err == nil { - // overwrite existing StringSlice *s = []string{jsonString} + return nil } @@ -37,13 +37,13 @@ func (s *StringSlice) UnmarshalJSON(b []byte) error { // attempt to unmarshal as a string slice type err = json.Unmarshal(b, &jsonSlice) if err == nil { - // overwrite existing StringSlice *s = jsonSlice + return nil } - return errors.New("Failed to unmarshal StringSlice") + return errors.New("unable to unmarshal into StringSlice") } // UnmarshalYAML implements the Unmarshaler interface for the StringSlice type. @@ -54,9 +54,9 @@ func (s *StringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // attempt to unmarshal as a string type err := unmarshal(&yamlString) if err == nil { - // overwrite existing StringSlice *s = []string{yamlString} + return nil } @@ -65,11 +65,11 @@ func (s *StringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { // attempt to unmarshal as a string slice type err = unmarshal(&yamlSlice) if err == nil { - // overwrite existing StringSlice *s = yamlSlice + return nil } - return errors.New("Failed to unmarshal StringSlice") + return errors.New("unable to unmarshal into StringSlice") } diff --git a/yaml/ulimit.go b/yaml/ulimit.go index 830b2f5d..eab982cb 100644 --- a/yaml/ulimit.go +++ b/yaml/ulimit.go @@ -80,6 +80,7 @@ func (u *UlimitSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { Soft: value, Hard: value, }) + continue case len(limitParts) == 2: // capture value for soft limit @@ -100,6 +101,7 @@ func (u *UlimitSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { Soft: firstValue, Hard: secondValue, }) + continue default: return fmt.Errorf("Ulimit %s can only contain 1 `:` (colon)", ulimit) diff --git a/yaml/volume.go b/yaml/volume.go index 83165b78..55e2d817 100644 --- a/yaml/volume.go +++ b/yaml/volume.go @@ -66,6 +66,7 @@ func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { Destination: parts[0], AccessMode: "ro", }) + continue case len(parts) == 2: // append the element to the volume slice @@ -74,6 +75,7 @@ func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { Destination: parts[1], AccessMode: "ro", }) + continue case len(parts) == 3: // append the element to the volume slice @@ -82,6 +84,7 @@ func (v *VolumeSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { Destination: parts[1], AccessMode: parts[2], }) + continue default: return fmt.Errorf("Volume %s must contain at least 1 but no more than 2 `:`(colons)", volume)