simplify public interface - replace *Entry with Interface in interface.go#60
simplify public interface - replace *Entry with Interface in interface.go#60client9 wants to merge 5 commits intoapex:masterfrom client9:master
Conversation
|
failed to do golang stuff unrelated to the PR |
|
ahhh sweet I'll see if Semaphore has a more recent Go version now, and I'm down with a semver bump, I'm all for cleaning that up :D I'll take a closer look soon |
|
rocking. It's likely you'll want to do something a bit different, especially in tests with the casting. If v2 is on the table then, in my fantasy world, the Fielder interface would be replaced by just Fields (back to logrus), and the Fielder methods would be replaced by functions (get the names, sort, etc) to keep the interface small. But I'm sure you have reasons to use the interface. Otherwise, If we moved the following from onward! // Fielder is an interface for providing fields to custom types.
type Fielder interface {
Fields() Fields
}
// Fields represents a map of entry level data used for structured logging.
type Fields map[string]interface{} |
SGTM! I still use the |
tj
left a comment
There was a problem hiding this comment.
Looks good to me! Just slap that one comment in there and it should be good to go
| return e.withFields(fields) | ||
| } | ||
|
|
||
| func (e *Entry) withFields(fields Fielder) *Entry { |
There was a problem hiding this comment.
ha will do (comment and move interface definitions).
|
ah crap I commited the wrong file... one sec. |
|
ahh found where you use // WithError returns a new entry with the "error" set to |
|
Updated Semaphore to use 1.9, looks like it's failing on: |
|
Oh I see.. needs some casts back to weird I didn't see this before. on it. |
|
Oh I see the problem... never sure how to solve this in golang + github. My branch uses: instead of my fork, so I don't see the error locally. |
|
@tj ready for re-review thx. |
|
Hi. Anything blocking this? |
|
@timbunce it's a bit of a breaking change so it'll have to be in 2.0, and I'm hoping to make some other changes in 2.0 as well but hard to say when that'll be |
|
Thanks for the update @tj. I'm glad to know you're planning for a v2. Can those of us interested in the module help out in any way? |
|
@timbunce not at the moment, I'll try and figure out what I'd like to do for the next version and start a branch that people could help out on, thanks for offering to help :D |
Hello!
In the spirit of simplifying the logrus API, this PR replaces
*Entryin the public interface to beInterface. Most of the changes were mechanical in nature (it just worked). One private helper function was needed in Entry (near trivial). Some casts were needed in the tests.Totally understand if you don't merge,since this is a semver API change. But if you are interested in a v2, I think interface.go can become completely self-contained. This would step 1 to do so.
Thanks for an interesting project!
n
After: