Comments (4)
Ah yeah, the reason I did that is the configuration is passed as a pointer to several other instances such as the worker here. If I change the pointer on the client instance it would not update any of the associated pointers (so I opted to change the reference instead, which does make the configuration mutable). Since the configuration can be updated at runtime I was having a hard time deciding how to rebuild other types which depend on it -- I think to be immutable it would need to create a new worker, which is a plausible alternative.
from honeybadger-go.
@joshuap what do you think about using Configuration
as a pointer everywhere.
For instance, creating a copy of a client, you could pass the configuration from existing one.
client := honeybadger.New(oldClient.Config)
right now you must dereference the pointer:
client := honeybadger.New(*oldClient.Config)
What is the reason that honeybadger.New
accepts Configuration
as a value and not as a pointer?
from honeybadger-go.
I think I can do that; it will just require rebuilding the instances which depend on the configuration when Configure
is called, otherwise the issue is that the Configuration values change but the objects (like the worker) which already exist don't get the updated values. I'll play with this a bit.
from honeybadger-go.
I fixed the issue of dereferencing the config in order to update it. I think we're basically not going the functional route, so this seems simpler.
@kostyantyn regarding passing a value rather than a pointer to things like honeybadger.Configure()
and honeybadger.New()
, I did that because the argument in those cases is used to update the pointer config which is created on the returned Client
instance. Passing a pointer would not reduce the number of copies, and I think honeybadger.Configure(honeybadger.Configuration{APIKey: "your api key"})
is a simpler API than honeybadger.Configure(&honeybadger.Configuration{APIKey: "your api key"})
(having to reference a pointer). Thoughts?
from honeybadger-go.
Related Issues (18)
- Can't `go get` honeybadger-go HOT 1
- Publicizing stack frame generation HOT 1
- Consider some mechanism for handling worker errors in the default client? HOT 3
- Build broken from clean master HOT 1
- Latest v.0.2.0 tag doesn't follow semver standard HOT 1
- Monitor doesn't Flush so the panics never get sent HOT 1
- Add Recover() function to recover, alert and continue from panics HOT 2
- errcheck lint warnings HOT 1
- Add config option to report errors synchronously
- Concurrent map writes HOT 5
- Remove deprecated metrics methods
- Context is shared across goroutines HOT 2
- Filtering sensitive data
- Automate releases with Release Please
- Can't access the original error in before notify. HOT 1
- Proposal to use stretchr/testify in tests HOT 3
- Error Class HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeybadger-go.