From a65c6ca5d4b7ec5f9784cece6ac25e3873876f3f Mon Sep 17 00:00:00 2001 From: Nikos Katirtzis Date: Mon, 6 Aug 2018 22:40:00 +0100 Subject: [PATCH 1/2] Update gitignore. --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index b15784e..618a29d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,9 @@ _testmain.go *.test *.prof .vscode + +# OS generated files +.DS_Store + +# IDEA files +**/.idea \ No newline at end of file From 0d7bd0b4dfdba220f14f0bdc23992bc1d6c7ad1a Mon Sep 17 00:00:00 2001 From: Nikos Katirtzis Date: Mon, 6 Aug 2018 22:41:10 +0100 Subject: [PATCH 2/2] Add more options to NewConfiguration using functional options. --- configuration.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configuration.go b/configuration.go index 9f83ff0..380facb 100644 --- a/configuration.go +++ b/configuration.go @@ -55,12 +55,17 @@ type Configuration struct { } // NewConfiguration create new configuration -func NewConfiguration(basePath string) *Configuration { +func NewConfiguration(basePath string, options ...func(*Configuration)) *Configuration { cfg := &Configuration{ BasePath: basePath, DefaultHeader: make(map[string]string), UserAgent: "go-bitbucket/1.0.0/go", } + + for _, option := range options { + option(cfg) + } + return cfg }