Skip to content

Conversation

@ynguyensegment
Copy link
Contributor

Add new function to allow creating clients with configurations

return NewWithConfig(writeKey, Config{})
}

func NewWithConfig(writeKey string, config Config) *Client {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think if Config contains the writeKey?

func New(writeKey string) *Client {
  return NewWithConfig(Config{WriteKey: writeKey})
}

func NewWithConfig(config Config) *Client {
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configs tend to imply optionality. The writekey is not optional. I am not sure it belongs in the config

client.go Outdated
}
}

func getFinalConfig(c Config) Config {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFinalConfig doesn't really explain much.
Could you consider rename/refactor to

func applyDefaultConfig(c *Config){
// sets default inline
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming is hard. How do parents do this

prayansh and others added 6 commits August 26, 2019 17:39
* Release v0.0.2-webhookfn

* hide sensitive payload request. support PrintErrors using Config

* update message

* Release v1.0.0-webhookfn
* origin/master:
  Fix time.Ticker leak in Client
  go fmt
  dep -> go module
@tysonmote tysonmote self-requested a review July 12, 2021 17:11
@tysonmote
Copy link
Contributor

I'm going to merge and tag this release as v2.0.0 because it's a breaking API change (albeit minor).

▶ go test ./... -v
=== RUN   TestBuffer
=== RUN   TestAddMultiple
--- PASS: TestAddMultiple (0.00s)
=== RUN   TestAddMultipleMarshalReset
--- PASS: TestAddMultipleMarshalReset (0.00s)
=== RUN   TestAddMultipleReset
--- PASS: TestAddMultipleReset (0.00s)
=== RUN   TestAddNew
--- PASS: TestAddNew (0.00s)
=== RUN   TestMarshalEmptyArray
--- PASS: TestMarshalEmptyArray (0.00s)
=== RUN   TestMarshalSingleArray
--- PASS: TestMarshalSingleArray (0.00s)
=== RUN   TestNewBuffer
--- PASS: TestNewBuffer (0.00s)
--- PASS: TestBuffer (0.00s)
=== RUN   TestClient
=== RUN   TestChannelFlow
--- PASS: TestChannelFlow (0.25s)
=== RUN   TestClose
--- PASS: TestClose (0.00s)
=== RUN   TestNewClient
--- PASS: TestNewClient (0.00s)
=== RUN   TestSetErrors
--- PASS: TestSetErrors (0.00s)
=== RUN   TestSetFull
--- PASS: TestSetFull (0.00s)
=== RUN   TestSetOnce
--- PASS: TestSetOnce (0.00s)
--- PASS: TestClient (0.25s)
PASS
ok  	github.com/segmentio/objects-go	0.614s

@tysonmote tysonmote merged commit b2c2d27 into master Jul 12, 2021
@tysonmote tysonmote deleted the client_configs branch July 12, 2021 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants